String sessionId = reqMessage.getSessionId();
if (reqMessage.isFault()) {
SCBaseServlet.compositeRegistry.removeSCMPLargeResponse(sessionId);
SCBaseServlet.compositeRegistry.removeSCMPLargeRequest(sessionId);
// fault received nothing to to return - delete largeRequest/largeResponse
SCMPMessageFault scmpFault = new SCMPMessageFault(reqMessage.getSCMPVersion(), SCMPError.BAD_REQUEST, "messagType="
+ reqMessage.getMessageType());
scmpFault.setMessageType(reqMessage.getMessageType());
scmpFault.setLocalDateTime();
// write reply to servlet output stream
this.writeResponse(reqMessage, scReply, response);
return;
}
if (this.handleLargeResponse(request, response, reqMessage)) {
// large message and response has been handled no need to continue
return;
}
if (this.handleLargeRequestNeeded(request, response, reqMessage)) {
SCMPMessage message = this.handleLargeRequest(request, response, reqMessage);
if (message == null) {
// reply inside
return;
}
reqMessage = message;
}
String messageTypeString = reqMessage.getMessageType();
int oti = reqMessage.getHeaderInt(SCMPHeaderAttributeKey.OPERATION_TIMEOUT);
switch (SCMPMsgType.getMsgType(messageTypeString)) {
case SRV_CREATE_SESSION:
scReply = ((SCBaseSessionServlet) this).baseCreateSession(reqMessage, oti);
break;
case SRV_DELETE_SESSION:
scReply = ((SCBaseSessionServlet) this).baseDeleteSession(reqMessage, oti);
break;
case SRV_ABORT_SESSION:
scReply = ((SCBaseSessionServlet) this).baseAbortSession(reqMessage, oti);
break;
case SRV_EXECUTE:
scReply = ((SCBaseSessionServlet) this).baseExecute(reqMessage, oti);
break;
case SRV_SUBSCRIBE:
scReply = ((SCBasePublishServlet) this).baseSubscribe(reqMessage, oti);
break;
case SRV_CHANGE_SUBSCRIPTION:
scReply = ((SCBasePublishServlet) this).baseChangeSubscription(reqMessage, oti);
break;
case SRV_UNSUBSCRIBE:
scReply = ((SCBasePublishServlet) this).baseUnsubscribe(reqMessage, oti);
break;
case SRV_ABORT_SUBSCRIPTION:
scReply = ((SCBasePublishServlet) this).baseAbortSubscription(reqMessage, oti);
break;
default:
scReply = new SCMPMessageFault(reqMessage.getSCMPVersion(), SCMPError.BAD_REQUEST, "Unknown message type received.");
break;
}
} catch (Exception e) {
LOGGER.error("Processing message failed.", e);
// fault received nothing to to return - delete largeRequest/largeResponse
SCMPMessageFault scmpFault = new SCMPMessageFault(reqMessage.getSCMPVersion(), SCMPError.SERVER_ERROR,
"Processing message failed when calling servlet API");
scmpFault.setMessageType(reqMessage.getMessageType());
scmpFault.setLocalDateTime();
}
this.writeResponse(reqMessage, scReply, response);
}