@Override public void onRequest(AtmosphereResource resource) { if (pushHandler == null) { getLogger().warning( "AtmosphereHandler.onRequest called before PushHandler has been set. This should really not happen"); return; } AtmosphereRequest req = resource.getRequest(); if (req.getMethod().equalsIgnoreCase("GET")) { onConnect(resource); } else if (req.getMethod().equalsIgnoreCase("POST")) { onMessage(resource); } }
resource.getRequest(), service); VaadinSession session = null;
@Override public String uri() { String uri = resource.getRequest().getRequestURI(); if (resource.getRequest().getQueryString() != null) { uri += "?" + resource.getRequest().getQueryString(); } return uri; }
@Override public boolean isPolling() { HttpServletRequest req = meteor.getAtmosphereResource().getRequest(); boolean isWebsocket = req.getAttribute(WebSocket.WEBSOCKET_SUSPEND) != null || req.getAttribute(WebSocket.WEBSOCKET_RESUME) != null; // TODO how to detect non-polling transports? return !isWebsocket; }
@Override public void onRequest(final AtmosphereResource resource) throws IOException { LOG.fine("onRequest"); try { invokeInternal(null, resource.getRequest().getServletContext(), resource.getRequest(), resource.getResponse()); } catch (Exception e) { LOG.log(Level.WARNING, "Failed to invoke service", e); } } }
@Override public void onRequest(final AtmosphereResource resource) throws IOException { LOG.fine("onRequest"); try { invokeInternal(null, resource.getRequest().getServletContext(), resource.getRequest(), resource.getResponse()); } catch (Exception e) { LOG.log(Level.WARNING, "Failed to invoke service", e); } } }
@Override public void onRequest(final AtmosphereResource resource) throws IOException { LOG.fine("onRequest"); try { invokeInternal(null, resource.getRequest().getServletContext(), resource.getRequest(), resource.getResponse()); } catch (Exception e) { LOG.log(Level.WARNING, "Failed to invoke service", e); } } }
@Override public void onRequest(final AtmosphereResource resource) throws IOException { LOG.fine("onRequest"); try { invokeInternal(null, resource.getRequest().getServletContext(), resource.getRequest(), resource.getResponse()); } catch (Exception e) { LOG.log(Level.WARNING, "Failed to invoke service", e); } } }
@Override public HttpSession getSession(boolean create) { if (atmResource.session() != null) { return atmResource.session(); } else if (atmResource.getRequest() != null) { return atmResource.getRequest().getSession(create); } else { return null; } }
public ManagedStreamResponseWriter(GwtAtmosphereResourceImpl resource) { super(resource); String userAgent = resource.getAtmosphereResource().getRequest().getHeader("User-Agent"); chrome = userAgent != null && userAgent.contains("Chrome"); }
public ManagedStreamResponseWriter(GwtAtmosphereResourceImpl resource) { super(resource); String userAgent = resource.getAtmosphereResource().getRequest().getHeader("User-Agent"); chrome = userAgent != null && userAgent.contains("Chrome"); }
AtmosphereRequest req = resource.getRequest(); VaadinServletRequest vaadinRequest = new VaadinServletRequest(req, service);
@Override public void onDisconnect(AtmosphereResourceEvent event) { super.onDisconnect(event); final String srid = (String)event.getResource().getRequest() .getAttribute(ApplicationConfig.SUSPENDED_ATMOSPHERE_RESOURCE_UUID); LOG.log(Level.FINE, "Unregistrering suspended resource: {}", srid); suspendedResponses.remove(srid); }
@Ready public String onReady(final AtmosphereResource resource) { String AuthHeader = resource.getRequest().getHeader("Authorization"); ...DO AUTH HERE logger.info("Resource {} connected ", resource.uuid()); return "Connect " + resource.uuid(); }
@Override public void onSuspend(AtmosphereResourceEvent event) { if (log.isDebugEnabled()) { AtmosphereRequest atmosphereRequest = event.getResource().getRequest(); String transport = atmosphereRequest.getHeader(HeaderConfig.X_ATMOSPHERE_TRANSPORT); log.debug(String.format("Suspending the %s response from ip %s:%s", transport == null ? "websocket" : transport, atmosphereRequest.getRemoteAddr(), atmosphereRequest.getRemotePort())); } }
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 void writeAndResume(Object message) throws IOException { try { AtmospherePollService.writeResponse(atm, message); } finally { atm.getRequest().removeAttribute(GWT_SUSPENDED); atm.resume(); } }
public void onRequest(AtmosphereResource resource) throws IOException { AtmosphereRequest r = resource.getRequest(); // We only handle GET. POST are supported by PrimeFaces directly via the Broadcaster. if (r.getMethod().equalsIgnoreCase("GET")) { applyRules(resource); } else { StringBuilder stringBuilder = read(resource); resource.getAtmosphereConfig().metaBroadcaster().broadcastTo("/*", stringBuilder.toString()); } }
@Override public void onSuspend(AtmosphereResourceEvent event) { final String srid = (String)event.getResource().getRequest() .getAttribute(ApplicationConfig.SUSPENDED_ATMOSPHERE_RESOURCE_UUID); LOG.log(Level.FINE, "Registrering suspended resource: {}", srid); suspendedResponses.put(srid, event.getResource().getResponse()); AsyncIOWriter writer = event.getResource().getResponse().getAsyncIOWriter(); if (writer instanceof AtmosphereInterceptorWriter) { ((AtmosphereInterceptorWriter)writer).interceptor(interceptor); } }
public StreamSocket(AtmosphereResource resource) { super(resource); this.isAndroid = isAndroid(resource.getRequest().getHeader("user-agent")); resource.getResponse().setContentType(streamContentType()); }