atmosphere.addAtmosphereHandler("/*", new PushAtmosphereHandler()); atmosphere.addInitParameter(ApplicationConfig.BROADCASTER_CACHE, UUIDBroadcasterCache.class.getName());
@Init public void init() { framework.addAtmosphereHandler(url, this); }
@Override public void configure(final AtmosphereConfig config) { framework = config.framework(); supportWebSocket = config.framework().getAsyncSupport().supportWebSocket(); config.properties().put(HeaderConfig.JSONP_CALLBACK_NAME, "c"); for (AtmosphereInterceptor i : framework.interceptors()) { if (HeartbeatInterceptor.class.isAssignableFrom(i.getClass())) { HeartbeatInterceptor.class.cast(i).paddingText("h".getBytes()).heartbeatFrequencyInSeconds(25); } } if (config.handlers().size() == 0) { framework.addAtmosphereHandler("/*", ECHO_ATMOSPHEREHANDLER); } }
@Override public void init(final ServletConfig sc) throws ServletException { if (!initialized) { super.init(new ServletConfigDefaultsFacade(sc, DEFAULT_INIT_PARAMETERS)); this.initialized = true; String mapping = (String) sc.getServletContext() .getAttribute(PushContextFactoryImpl.PUSH_HANDLER_MAPPING_ATTRIBUTE); if (mapping == null) { mapping = "*"; } ReflectorServletProcessor r = new ReflectorServletProcessor(this); r.setFilterClassName(PushHandlerFilter.class.getName()); framework().addAtmosphereHandler(mapping, r).initAtmosphereHandler(sc); } }
AtmosphereServlet s = new AtmosphereServlet(); AtmosphereFramework f = s.framework(); ReflectorServletProcessor r = new ReflectorServletProcessor(); r.setServletClassName("com.sun.jersey.spi.spring.container.servlet.SpringServlet"); f.addAtmosphereHandler("/api/*", r); ServletRegistration atmosphereServletRegistration = ctx.addServlet("AtmosphereServlet", s);
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); } }
public AtmosphereBridge(ServletContext context, String path) { AtmosphereServlet servlet = null; try { servlet = context.createServlet(AtmosphereServlet.class); } catch (ServletException e) { throw new RuntimeException(e); } AtmosphereFramework framework = servlet.framework(); framework.addAtmosphereHandler("/", new AtmosphereHandlerAdapter() { @Override public void onRequest(AtmosphereResource resource) throws IOException { if (resource.transport() == TRANSPORT.WEBSOCKET) { if (resource.getRequest().getMethod().equals("GET")) { wsActions.fire(new AtmosphereServerWebSocket(resource)); } } else { httpActions.fire(new AtmosphereServerHttpExchange(resource)); } } }); ServletRegistration.Dynamic reg = context.addServlet("wes#" + UUID.randomUUID(), servlet); reg.setAsyncSupported(true); reg.addMapping(path); }
@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; }
public AtmosphereWebSocketJettyDestination(Bus bus, DestinationRegistry registry, EndpointInfo ei, JettyHTTPServerEngineFactory serverEngineFactory) throws IOException { super(bus, registry, ei, serverEngineFactory == null ? null : new URL(getNonWSAddress(ei)), serverEngineFactory); framework = new AtmosphereFramework(false, true); framework.setUseNativeImplementation(false); addInitParameter(framework, initParams, ApplicationConfig.PROPERTY_NATIVE_COMETSUPPORT, "true"); addInitParameter(framework, initParams, ApplicationConfig.PROPERTY_SESSION_SUPPORT, "true"); addInitParameter(framework, initParams, ApplicationConfig.WEBSOCKET_SUPPORT, "true"); addInitParameter(framework, initParams, ApplicationConfig.WEBSOCKET_PROTOCOL_EXECUTION, "true"); // workaround for atmosphere's jsr356 initialization requiring servletConfig addInitParameter(framework, initParams, ApplicationConfig.WEBSOCKET_SUPPRESS_JSR356, "true"); AtmosphereUtils.addInterceptors(framework, bus); framework.addAtmosphereHandler("/", new DestinationHandler()); }
atmosphere.addAtmosphereHandler("/*", new PushAtmosphereHandler()); atmosphere.addInitParameter(ApplicationConfig.BROADCASTER_CACHE, UUIDBroadcasterCache.class.getName());
public AtmosphereWebSocketJettyDestination(Bus bus, DestinationRegistry registry, EndpointInfo ei, JettyHTTPServerEngineFactory serverEngineFactory) throws IOException { super(bus, registry, ei, serverEngineFactory == null ? null : new URL(getNonWSAddress(ei)), serverEngineFactory); framework = new AtmosphereFramework(false, true); framework.setUseNativeImplementation(false); addInitParameter(framework, initParams, ApplicationConfig.PROPERTY_NATIVE_COMETSUPPORT, "true"); addInitParameter(framework, initParams, ApplicationConfig.PROPERTY_SESSION_SUPPORT, "true"); addInitParameter(framework, initParams, ApplicationConfig.WEBSOCKET_SUPPORT, "true"); addInitParameter(framework, initParams, ApplicationConfig.WEBSOCKET_PROTOCOL_EXECUTION, "true"); // workaround for atmosphere's jsr356 initialization requiring servletConfig addInitParameter(framework, initParams, ApplicationConfig.WEBSOCKET_SUPPRESS_JSR356, "true"); AtmosphereUtils.addInterceptors(framework, bus); framework.addAtmosphereHandler("/", new DestinationHandler()); }
@Override public void init(final ServletConfig sc) throws ServletException { framework().interceptor(new CometdAtmosphereInterceptor()); framework().setUseStreamForFlushingComments(false); framework().addInitParameter("transports", WebSocketTransport.class.getName()); framework().addInitParameter(ApplicationConfig.WEBSOCKET_CONTENT_TYPE, "application/json"); super.init(sc); ReflectorServletProcessor r = new ReflectorServletProcessor(); r.setServletClassName(org.cometd.java.annotation.AnnotationCometdServlet.class.getName()); framework().addAtmosphereHandler("/*", r).initAtmosphereHandler(framework().getServletConfig()); }
private AtmosphereFramework create(Bus bus) { final AtmosphereFramework instance = new AtmosphereFramework(false, true); instance.setUseNativeImplementation(false); instance.addInitParameter(ApplicationConfig.PROPERTY_NATIVE_COMETSUPPORT, "true"); instance.addInitParameter(ApplicationConfig.PROPERTY_SESSION_SUPPORT, "true"); instance.addInitParameter(ApplicationConfig.WEBSOCKET_SUPPORT, "true"); instance.addInitParameter(ApplicationConfig.WEBSOCKET_PROTOCOL_EXECUTION, "true"); // workaround for atmosphere's jsr356 initialization requiring servletConfig instance.addInitParameter(ApplicationConfig.WEBSOCKET_SUPPRESS_JSR356, "true"); AtmosphereUtils.addInterceptors(instance, bus); instance.addAtmosphereHandler("/", new DestinationHandler()); return instance; }
private AtmosphereFramework create(Bus bus) { final AtmosphereFramework instance = new AtmosphereFramework(false, true); instance.setUseNativeImplementation(false); instance.addInitParameter(ApplicationConfig.PROPERTY_NATIVE_COMETSUPPORT, "true"); instance.addInitParameter(ApplicationConfig.PROPERTY_SESSION_SUPPORT, "true"); instance.addInitParameter(ApplicationConfig.WEBSOCKET_SUPPORT, "true"); instance.addInitParameter(ApplicationConfig.WEBSOCKET_PROTOCOL_EXECUTION, "true"); // workaround for atmosphere's jsr356 initialization requiring servletConfig instance.addInitParameter(ApplicationConfig.WEBSOCKET_SUPPRESS_JSR356, "true"); AtmosphereUtils.addInterceptors(instance, bus); instance.addAtmosphereHandler("/", new DestinationHandler()); return instance; }
atmosphere.addAtmosphereHandler("/*", new PushAtmosphereHandler()); atmosphere.addInitParameter(ApplicationConfig.BROADCASTER_CACHE, UUIDBroadcasterCache.class.getName());
framework.addAtmosphereHandler(e.getKey(), e.getValue()); framework.addAtmosphereHandler(Broadcaster.ROOT_MASTER, REFLECTOR_ATMOSPHEREHANDLER);
framework.addAtmosphereHandler(e.getKey(), e.getValue()); framework.addAtmosphereHandler(Broadcaster.ROOT_MASTER, REFLECTOR_ATMOSPHEREHANDLER);
public AtmosphereWebSocketUndertowDestination(Bus bus, DestinationRegistry registry, EndpointInfo ei, UndertowHTTPServerEngineFactory serverEngineFactory) throws IOException { super(bus, registry, ei, serverEngineFactory); framework = new AtmosphereFramework(false, true); framework.setUseNativeImplementation(false); framework.addInitParameter(ApplicationConfig.PROPERTY_NATIVE_COMETSUPPORT, "true"); framework.addInitParameter(ApplicationConfig.PROPERTY_SESSION_SUPPORT, "true"); framework.addInitParameter(ApplicationConfig.WEBSOCKET_SUPPORT, "true"); framework.addInitParameter(ApplicationConfig.WEBSOCKET_PROTOCOL_EXECUTION, "true"); // workaround for atmosphere's jsr356 initialization requiring servletConfig framework.addInitParameter(ApplicationConfig.WEBSOCKET_SUPPRESS_JSR356, "true"); AtmosphereUtils.addInterceptors(framework, bus); framework.addAtmosphereHandler("/", new DestinationHandler()); framework.init(); executor = bus.getExtension(WorkQueueManager.class).getAutomaticWorkQueue(); }
public AtmosphereWebSocketUndertowDestination(Bus bus, DestinationRegistry registry, EndpointInfo ei, UndertowHTTPServerEngineFactory serverEngineFactory) throws IOException { super(bus, registry, ei, serverEngineFactory); framework = new AtmosphereFramework(false, true); framework.setUseNativeImplementation(false); framework.addInitParameter(ApplicationConfig.PROPERTY_NATIVE_COMETSUPPORT, "true"); framework.addInitParameter(ApplicationConfig.PROPERTY_SESSION_SUPPORT, "true"); framework.addInitParameter(ApplicationConfig.WEBSOCKET_SUPPORT, "true"); framework.addInitParameter(ApplicationConfig.WEBSOCKET_PROTOCOL_EXECUTION, "true"); // workaround for atmosphere's jsr356 initialization requiring servletConfig framework.addInitParameter(ApplicationConfig.WEBSOCKET_SUPPRESS_JSR356, "true"); AtmosphereUtils.addInterceptors(framework, bus); framework.addAtmosphereHandler("/", new DestinationHandler()); framework.init(); executor = bus.getExtension(WorkQueueManager.class).getAutomaticWorkQueue(); }