* @param res Response of the servlet
*/
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
String ME;
// null if the message was not passed via the binary protocol
MsgHolder binaryMsg = readBinaryProtocol(req, res);
String actionType = req.getHeader("ActionType");
if (actionType == null) {
actionType = getParameter(req, "ActionType", "NONE");
}
synchronized(AppletServlet.class) {
requestCounter++; // For logging only
String appletInstanceCount = getParameter(req, "appletInstanceCount", "0");
ME = this.getClass().getName() + "-" + req.getRemoteAddr() + "-#" + appletInstanceCount + "req" + requestCounter + "-" + actionType;
}
//String appletInstanceCount = getParameter(req, "appletInstanceCount", "0");
if (actionType.equalsIgnoreCase(I_XmlBlasterAccessRaw.CONNECT_NAME) ||
actionType.equalsIgnoreCase(I_XmlBlasterAccessRaw.DISCONNECT_NAME) ||
actionType.equalsIgnoreCase(I_XmlBlasterAccessRaw.PONG_NAME) ||
actionType.equalsIgnoreCase(I_XmlBlasterAccessRaw.CREATE_SESSIONID_NAME)) { // "connect", "disconnect"
doGetFake(ME, req, res, actionType, binaryMsg);
return;
}
res.setContentType("text/plain");
//HttpSession session = req.getSession(false);
String sessionId = req.getRequestedSessionId();
ME += "-" + sessionId;
if (log.isLoggable(Level.FINE)) log.fine("Entering servlet doPost() ...");
Global glob = null;
I_XmlBlasterAccess xmlBlaster = null;
PushHandler pushHandler = null;
Object returnObject = null;
try {
pushHandler = getPushHandler(req);
xmlBlaster = pushHandler.getXmlBlasterAccess();
glob = xmlBlaster.getGlobal();
}
catch (XmlBlasterException e) {
log.warning("Caught XmlBlaster Exception: " + e.getMessage());
writeResponse(res, I_XmlBlasterAccessRaw.EXCEPTION_NAME, e.getMessage());
return;
}
try {
// Extract the message data
MsgHolder msg = extractMessage(ME, log, req, binaryMsg);
String oid = msg.getOid();
String key = msg.getKey();
String qos = msg.getQos();
String xmlRequest = msg.getKey(); // in case of xmlScript the request is sent as the key (all other are null)
byte[] content = msg.getContent();
if (actionType.equals(I_XmlBlasterAccessRaw.PING_NAME)) { // "ping"
if (log.isLoggable(Level.FINE)) log.fine("ping arrived, qos=" + qos);
Hashtable map = new Hashtable();
if (xmlBlaster.isAlive()) {