private void reInject(AtmosphereRequest request, AtmosphereResponse response, String body) throws IOException, ServletException { request.setAttribute("sockjs.skipInterceptor", Boolean.TRUE); framework.doCometSupport(request.body(body), response); request.setAttribute("sockjs.skipInterceptor", null); }
@Override public Action inspect(AtmosphereResource r) { Object msg = r.getRequest().getAttribute(Constants.MESSAGE_OBJECT); if (msg != null && AtmosphereMessage.class.isAssignableFrom(msg.getClass())) { AtmosphereMessage<?> m = AtmosphereMessage.class.cast(msg); encoder.classToEncode((Class<? extends AtmosphereMessage<?>>) m.getClass()); if (m.type().equals(AtmosphereMessage.TYPE.STRING)) { r.getRequest().body(m.asString()); } else { r.getRequest().body(m.asByte()); } } return Action.CONTINUE; } }
@Override public void onMessage(AtmosphereResourceImpl resource, SocketIOSessionOutbound outbound, String message) { startHeartbeatTimer(); if (atmosphereHandler != null && message != null) { try { synchronized (atmosphereHandler) { if (SocketIOAtmosphereHandler.class.isAssignableFrom(atmosphereHandler.getClass())) { SocketIOAtmosphereHandler.class.cast(atmosphereHandler).onMessage(resource, outbound, message); } else { SocketIOProtocol p = mapper.readValue(message, SocketIOProtocol.class); for (String msg : p.getArgs()) { AtmosphereRequest r = resource.getRequest(); r.setAttribute(SocketIOProtocol.class.getName(), p); r.body(msg).method("POST"); resource.disableSuspend(true); atmosphereHandler.onRequest(resource); } } } } catch (Throwable e) { logger.error("Session[" + sessionId + "]: Exception thrown by SocketIOInbound.onMessage()", e); } } }
request.body(data); if (data != null && data.length() > 0) { List<SocketIOPacketImpl> list = SocketIOPacketImpl.parse(data);
@Override public void onMessage(AtmosphereResourceImpl resource, SocketIOSessionOutbound outbound, String message) { startHeartbeatTimer(); if (atmosphereHandler != null && message != null) { try { synchronized (atmosphereHandler) { if (SocketIOAtmosphereHandler.class.isAssignableFrom(atmosphereHandler.getClass())) { SocketIOAtmosphereHandler.class.cast(atmosphereHandler).onMessage(resource, outbound, message); } else { SocketIOProtocol p = mapper.readValue(message, SocketIOProtocol.class); for (String msg : p.getArgs()) { AtmosphereRequest r = resource.getRequest(); r.setAttribute(SocketIOProtocol.class.getName(), p); r.body(msg).method("POST"); resource.disableSuspend(true); atmosphereHandler.onRequest(resource); } } } } catch (Throwable e) { logger.error("Session[" + sessionId + "]: Exception thrown by SocketIOInbound.onMessage()", e); } } }
request.setAttribute(POST_MESSAGE_RECEIVED, data); request.body(data); if (data != null && data.length() > 0) { List<SocketIOPacketImpl> list = SocketIOPacketImpl.parse(data);
resource.getRequest().body(body);
async = true; request.bodyHandler(body -> { r.body(body.toString()); try { route(r, res);