@Override public void setAttribute(String name, Object attribute) { r.getRequest().setAttribute(name, attribute); }
@Override public <T> void setAttribute(String name, T value) { atmResource.getRequest().setAttribute(name, value); }
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); }
protected Continuation getContinuation(AtmosphereRequest req) { Continuation falseContinuation = (Continuation) req.getAttribute(Continuation.ATTRIBUTE); req.setAttribute(Continuation.ATTRIBUTE, null); Continuation c = ContinuationSupport.getContinuation(req); req.setAttribute(Continuation.ATTRIBUTE, falseContinuation); return c; }
@Override public <T> void setAttribute(String name, T value) { atmResource.getRequest().setAttribute(name, value); }
@Override protected void onAfterRequestDeserialized(RPCRequest rpcRequest) { getAtmosphereResource().getRequest().setAttribute(GWT_REQUEST, rpcRequest); }
public GwtAtmosphereResourceImpl(AtmosphereResource resource, AtmosphereGwtHandler servlet, int heartBeatInterval, boolean escapeText) throws IOException { this.atmosphereHandler = servlet; this.atmResource = resource; this.heartBeatInterval = heartBeatInterval; this.writer = createResponseWriter(); this.writer.escapeText(escapeText); resource.getRequest().setAttribute(GwtAtmosphereResource.class.getName(), this); }
public GwtAtmosphereResourceImpl(AtmosphereResource resource, AtmosphereGwtHandler servlet, int heartBeatInterval, boolean escapeText) throws IOException { this.atmosphereHandler = servlet; this.atmResource = resource; this.heartBeatInterval = heartBeatInterval; this.writer = createResponseWriter(); this.writer.escapeText(escapeText); resource.getRequest().setAttribute(GwtAtmosphereResource.class.getName(), this); }
private final void addContextValue(AtmosphereRequest request, String name, Object value) { if (request.resource().transport().equals(AtmosphereResource.TRANSPORT.WEBSOCKET)) { request.setAttribute(name, value); } else { request.getSession().setAttribute(name, value); } }
protected SuspendInfo suspend(long timeout) { AtmosphereResource atm = getAtmosphereResource(); atm.getRequest().setAttribute(GWT_SUSPENDED, true); atm.suspend(timeout, false); return new SuspendInfo(atm); }
@Override protected SocketIOSession connect(SocketIOSession session, AtmosphereResourceImpl resource, AtmosphereHandler atmosphereHandler, SocketIOSessionFactory sessionFactory) throws IOException { if (session == null) { session = sessionFactory.createSession(resource, atmosphereHandler); resource.getRequest().setAttribute(SocketIOAtmosphereHandler.SOCKETIO_SESSION_ID, session.getSessionId()); } XHRPollingSessionHelper handler = createHelper(session); handler.connect(resource); return session; }
protected SocketIOSession connect(SocketIOSession session, AtmosphereResourceImpl resource, AtmosphereHandler atmosphereHandler, SocketIOSessionFactory sessionFactory) throws IOException { if (session == null) { session = sessionFactory.createSession(resource, atmosphereHandler); resource.getRequest().setAttribute(SocketIOAtmosphereHandler.SOCKETIO_SESSION_ID, session.getSessionId()); } XHRSessionHelper handler = createHelper(session); handler.connect(resource); return session; }
protected SuspendInfo suspend() { AtmosphereResource atm = getAtmosphereResource(); if (atm == null) { throw new UnexpectedException("Failed to find Atmosphere resource have you setup Atmosphere?", null); } atm.getRequest().setAttribute(GWT_SUSPENDED, true); atm.suspend(-1, false); return new SuspendInfo(atm); }
protected SocketIOSession connect(SocketIOSession session, AtmosphereResourceImpl resource, AtmosphereHandler atmosphereHandler, SocketIOSessionFactory sessionFactory) throws IOException { if (session == null) { session = sessionFactory.createSession(resource, atmosphereHandler); resource.getRequest().setAttribute(SocketIOAtmosphereHandler.SOCKETIO_SESSION_ID, session.getSessionId()); } XHRSessionHelper handler = createHelper(session); handler.connect(resource); return session; }
@Override protected SocketIOSession connect(SocketIOSession session, AtmosphereResourceImpl resource, AtmosphereHandler atmosphereHandler, SocketIOSessionFactory sessionFactory) throws IOException { if (session == null) { session = sessionFactory.createSession(resource, atmosphereHandler); resource.getRequest().setAttribute(SocketIOAtmosphereHandler.SOCKETIO_SESSION_ID, session.getSessionId()); } XHRPollingSessionHelper handler = createHelper(session); handler.connect(resource); return session; }
@Override public U map(AtmosphereRequest req, Map<String, U> handlers) { U handler = super.map(req, handlers); if (handler == null) { synchronized (config) { LOGER.trace("Preserving backward PrimeFaces behavior"); PrimeAtmosphereHandler pah = new PrimeAtmosphereHandler(configureRules(config.getServletConfig())); String path = computePath(req); config.framework().addAtmosphereHandler(path, pah); handler = (U) config.framework().getAtmosphereHandlers().get(path); req.setAttribute(FrameworkConfig.MAPPED_PATH, path); } } return handler; }
@Override public void onStateChange(AtmosphereResourceEvent event) throws IOException { if (event.getMessage() == null || event.isCancelled() || event.isResuming() || event.isResumedOnTimeout()) { return; } AtmosphereResource resource = event.getResource(); AtmosphereRequest req = resource.getRequest(); AtmosphereResponse res = resource.getResponse(); PrintWriter writer = res.getWriter(); writer.print((String) event.getMessage()); writer.flush(); if (req.getParameter("transport").startsWith("longpoll")) { req.setAttribute("used", true); resource.resume(); } }
@Override public Action inspect(final AtmosphereResource r) { AtmosphereRequest request = r.getRequest(); if (r.transport().equals(AtmosphereResource.TRANSPORT.WEBSOCKET)) { if (r.getRequest().getAttribute(FrameworkConfig.INJECTED_ATMOSPHERE_RESOURCE) != null) { return Action.CANCELLED; } } request.setAttribute(Continuation.ATTRIBUTE, new AtmosphereContinuation(r)); return Action.CONTINUE; }
public void connect(AtmosphereResourceImpl resource) throws IOException { AtmosphereRequest request = resource.getRequest(); AtmosphereResponse response = resource.getResponse(); request.setAttribute(SESSION_KEY, session); response.setBufferSize(bufferSize); customConnect(request, response); is_open = true; session.onConnect(resource, this); finishSend(response); if (isStreamingConnection) { resource.suspend(); } }
public void connect(AtmosphereResourceImpl resource) throws IOException { AtmosphereRequest request = resource.getRequest(); AtmosphereResponse response = resource.getResponse(); request.setAttribute(SESSION_KEY, session); response.setBufferSize(bufferSize); customConnect(request, response); is_open = true; session.onConnect(resource, this); finishSend(response); if (isStreamingConnection) { resource.suspend(); } }