*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
SerializationService serializationService = Aura.getSerializationService();
LoggingService loggingService = Aura.getLoggingService();
ContextService contextService = Aura.getContextService();
ServerService serverService = Aura.getServerService();
AuraContext context = contextService.getCurrentContext();
response.setCharacterEncoding(UTF_ENCODING);
boolean written = false;
setNoCache(response);
try {
if (context.getFormat() != Format.JSON) {
throw new AuraRuntimeException("Invalid request, post must use JSON");
}
response.setContentType(getContentType(Format.JSON));
String msg = messageParam.get(request);
if (msg == null) {
throw new AuraRuntimeException("Invalid request, no message");
}
//
// handle transaction beacon JSON data
// FIXME: this should be an action.
//
String beaconData = beaconParam.get(request);
if (!"undefined".equals(beaconData) && !AuraTextUtil.isNullEmptyOrWhitespace(beaconData)) {
loggingService.setValue(LoggingService.BEACON_DATA, new JsonReader().read(beaconData));
}
String fwUID = Aura.getConfigAdapter().getAuraFrameworkNonce();
if (!fwUID.equals(context.getFrameworkUID())) {
throw new ClientOutOfSyncException("Framework has been updated");
}
context.setFrameworkUID(fwUID);
Message message;
loggingService.startTimer(LoggingService.TIMER_DESERIALIZATION);
try {
message = serializationService.read(new StringReader(msg), Message.class);
} finally {
loggingService.stopTimer(LoggingService.TIMER_DESERIALIZATION);
}
// The bootstrap action cannot not have a CSRF token so we let it
// through
boolean isBootstrapAction = false;