atmosphere.getAtmosphereConfig().getInitParameter( com.vaadin.server.Constants.SERVLET_PARAMETER_PUSH_SUSPEND_TIMEOUT_LONGPOLLING, -1));
trackMessageSize.configure(atmosphere.getAtmosphereConfig()); atmosphere.interceptor(trackMessageSize); } catch (ServletException e) {
@Override public void configure(AtmosphereConfig config) { servletPath = IOUtils.guestServletPath(config); config.framework().getAtmosphereConfig().properties().put("servletPath", servletPath); this.config = config; }
@Inject public AtmosphereController(HttpExecutionContext ec) throws Exception { this.httpExecutionContext = ec; framework = AtmosphereCoordinator.instance().framework(); config = framework.getAtmosphereConfig(); final String playSessionConverter = config.getInitParameter(AtmosphereCoordinator.PLAY_SESSION_CONVERTER); if(StringUtils.isNotBlank(playSessionConverter)){ converter = framework.newClassInstance(AtmospherePlaySessionConverter.class, (Class<AtmospherePlaySessionConverter>) IOUtils.loadClass(getClass(), playSessionConverter)); } else { converter = null; } }
protected void configureMetaBroadcasterCache(AtmosphereFramework framework) { MetaBroadcaster m = framework.metaBroadcaster(); m.cache(new MetaBroadcaster.ThirtySecondsCache(m, framework.getAtmosphereConfig())); }
private AtmosphereCoordinator() { framework = new AtmosphereFramework(); asynchronousProcessor = new NettyCometSupport(framework().getAtmosphereConfig()); framework.setAsyncSupport(asynchronousProcessor); suspendTimer = ExecutorsFactory.getScheduler(framework.getAtmosphereConfig()); mapper = framework.endPointMapper(); }
AtmosphereCoordinator() { framework = new AtmosphereFramework(); asynchronousProcessor = new NettyCometSupport(framework().getAtmosphereConfig()); framework.setAsyncSupport(asynchronousProcessor); suspendTimer = ExecutorsFactory.getScheduler(framework.getAtmosphereConfig()); mapper = framework.endPointMapper(); }
@Override public void operationComplete(ChannelFuture future) throws Exception { if (!future.isSuccess()) { future.channel().close(); } else { websocketChannels.add(ctx.channel()); ctx.channel().attr(ATTACHMENT).set(webSocket); if (config.noInternalAlloc()) { webSocket.resource(proxiedResource); } AtmosphereResponse response = config.noInternalAlloc() ? proxiedResponse : AtmosphereResponseImpl.newInstance(framework.getAtmosphereConfig(), atmosphereRequest, webSocket); webSocketProcessor.open(webSocket, atmosphereRequest, response); if (webSocketTimeout > 0) { webSocket.closeFuture(suspendTimer.scheduleAtFixedRate(() -> { if (webSocket.lastWriteTimeStampInMilliseconds() != 0 && (System.currentTimeMillis() - webSocket.lastWriteTimeStampInMilliseconds() > webSocketTimeout)) { logger.debug("Timing out {}", webSocket); webSocket.close(); } }, webSocketTimeout, webSocketTimeout, TimeUnit.MILLISECONDS)); } } } });
@Override public void operationComplete(ChannelFuture future) throws Exception { if (!future.isSuccess()) { future.channel().close(); } else { websocketChannels.add(ctx.channel()); ctx.channel().attr(ATTACHMENT).set(webSocket); if (config.noInternalAlloc()) { webSocket.resource(proxiedResource); } AtmosphereResponse response = config.noInternalAlloc() ? proxiedResponse : AtmosphereResponseImpl.newInstance(framework.getAtmosphereConfig(), atmosphereRequest, webSocket); webSocketProcessor.open(webSocket, atmosphereRequest, response); if (webSocketTimeout > 0) { webSocket.closeFuture(suspendTimer.scheduleAtFixedRate(() -> { if (webSocket.lastWriteTimeStampInMilliseconds() != 0 && (System.currentTimeMillis() - webSocket.lastWriteTimeStampInMilliseconds() > webSocketTimeout)) { logger.debug("Timing out {}", webSocket); webSocket.close(); } }, webSocketTimeout, webSocketTimeout, TimeUnit.MILLISECONDS)); } } } });
public void init(final ServletConfig sc) throws ServletException { super.init(sc); framework.setAsyncSupport(new WebLogicCometSupport(framework.getAtmosphereConfig())); framework.init(sc); }
@Override public Action suspended(AtmosphereRequest request, AtmosphereResponse response) throws IOException, ServletException { Action a = super.suspended(request, response); if (framework.getAtmosphereConfig().isSupportSession()) { AtmosphereResource r = request.resource(); HttpSession s = request.getSession(true); if (s != null) { sessions.put(r.uuid(), request.getSession(true)); } } return a; }
public void handle(AtmosphereFramework framework, Class<Object> annotatedClass) { try { Class<?> aClass = annotatedClass; PushEndpoint a = aClass.getAnnotation(PushEndpoint.class); List<AtmosphereInterceptor> l = new ArrayList<AtmosphereInterceptor>(); Object c = framework.newClassInstance(Object.class, aClass); AtmosphereHandler handler = framework.newClassInstance( PushEndpointHandlerProxy.class, PushEndpointHandlerProxy.class).configure(framework.getAtmosphereConfig(), c); l.add(framework.newClassInstance(AtmosphereInterceptor.class, PushEndpointInterceptor.class)); Class<? extends Broadcaster> b = (Class<? extends Broadcaster>) IOUtils.loadClass( this.getClass(), framework.getDefaultBroadcasterClassName()); framework.addAtmosphereHandler(a.value(), handler, broadcaster(framework, b, a.value()), l); } catch (Throwable e) { LOG.warn("", e); } }
Injector injector = (Injector) framework().getAtmosphereConfig().getServletContext().getAttribute(Injector.class.getName()); GuiceContainer guiceServlet = injector.getInstance(GuiceContainer.class); setDefaultBroadcasterClassName(broadcasterClassName) .setUseStreamForFlushingComments(true) .getAtmosphereConfig().setSupportSession(false); isJersey = true; } catch (Throwable t) {
@Override public Action suspended(AtmosphereRequest request, AtmosphereResponse response) throws IOException, ServletException { Action a = super.suspended(request, response); if (framework.getAtmosphereConfig().isSupportSession()) { AtmosphereResource r = request.resource(); HttpSession s = request.getSession(true); if (s != null) { sessions.put(r.uuid(), request.getSession(true)); } } return a; }
private Action iframe(AtmosphereResource r) { final AtmosphereResponse response = r.getResponse(); response.setContentType("text/html"); String origin = framework.getAtmosphereConfig().getInitParameter(SOCKS_JS_ORIGIN); if (origin == null) { origin = "http://localhost:8080/lib/sockjs.js"; } try { response.write(IFrameUtils.generateIFrame(origin)).flushBuffer(); } catch (IOException e) { logger.error("", e); } return Action.CANCELLED; }
if (framework.getAtmosphereConfig().isSupportSession()) { String[] transport = qs.get(HeaderConfig.X_ATMOSPHERE_TRANSPORT); if (transport != null && transport.length > 0) {
.addAnnotationPackage(PushEndpointProcessor.class); framework().getAtmosphereConfig().startupHook(new AtmosphereConfig.StartupHook() { public void started(AtmosphereFramework framework) { configureMetaBroadcasterCache(framework); PushContextFactory pcf = new PushContextFactory(framework().getAtmosphereConfig().metaBroadcaster()); PushContext c = pcf.getPushContext(); if (PushContextImpl.class.isAssignableFrom(c.getClass())) {
wsFactory.sendUnsupportedVersionResponse(ctx.channel()); } else { final NettyWebSocket webSocket = new NettyWebSocket(ctx.channel(), framework.getAtmosphereConfig(), config.noInternalAlloc(), config.binaryWrite()); final AtmosphereRequest atmosphereRequest = createAtmosphereRequest(ctx, request, EMPTY);
atmosphere.getAtmosphereConfig().getInitParameter( Constants.SERVLET_PARAMETER_PUSH_SUSPEND_TIMEOUT_LONGPOLLING, -1));
@Override public void init(ServletConfig sc) throws ServletException { super.init(sc); TrackMessageSizeInterceptor t = new TrackMessageSizeInterceptor(); t.excludedContentType("application/javascript").excludedContentType("text/html").excludedContentType("text/plain").messageDelimiter("<->"); t.configure(framework().getAtmosphereConfig()); framework().interceptor(t); framework().interceptor(new SwaggerSocketProtocolInterceptor()); logger.info("Swagger Socket installed {}", Version.getRawVersion()); } }