jettyServlet.service(request, response);
return;
}
response.setContentType("application/json");
Object json = JSON.parse(request.getParameter("message"));
Client eventStream = null;
if (json instanceof HashMap) {
List array = new ArrayList();
array.add(json);
json = array;
}
List array = (List) json;
boolean respondImmediately = false;
for (int i = 0;i < array.size(); i++) {
Map obj = (Map) array.get(i);
String channel = (String) obj.get("channel");
String clientId = (String) requestHelper.getRequest().getSession().getAttribute("clientId");
if (clientId != null) {
obj.put("clientId", clientId);
eventStream = (Client) request.getSession().getAttribute(clientId);
}
obj.remove("ext");
if (channel.startsWith("/meta")) {
obj.put("successful", true);
if (channel.equals("/meta/handshake")) {
obj.put("authSuccessful", true);
clientId = Math.random() + "";
request.getSession().setAttribute(clientId,eventStream = new Client(clientId));
eventStream.connectionId = clientId;
requestHelper.getRequest().getSession().setAttribute("clientId", clientId);
obj.put("clientId", clientId);
Map advice = new HashMap();
advice.put("reconnect", "retry");