@Override public BroadcasterFactory get() { return config.getBroadcasterFactory(); } });
@Override public BroadcasterFactory get() { return config.getBroadcasterFactory(); } });
@Override public Object fromString(String topic) { Broadcaster broadcaster; try { AtmosphereResource r = (AtmosphereResource) req.getAttribute(FrameworkConfig.ATMOSPHERE_RESOURCE); BroadcasterFactory bp = r.getAtmosphereConfig().getBroadcasterFactory(); Class<? extends Broadcaster> c; try { c = (Class<Broadcaster>) Class.forName((String) req.getAttribute(ApplicationConfig.BROADCASTER_CLASS)); } catch (Throwable e) { throw new IllegalStateException(e.getMessage()); } broadcaster = bp.lookup(c, topic, true); } catch (Throwable ex) { throw new WebApplicationException(ex); } logger.trace("Injected Broadcaster {}", broadcaster); req.setAttribute(AtmosphereFilter.INJECTED_BROADCASTER, broadcaster); return broadcaster; } }
@Override public BroadcasterFactory getValue() { return getAtmosphereResource(AtmosphereResource.class, true).getAtmosphereConfig().getBroadcasterFactory(); } };
BroadcasterFactory _get() { return getAtmosphereResource(AtmosphereResource.class, true).getAtmosphereConfig().getBroadcasterFactory(); }
@Override public void configure(AtmosphereConfig config) { heartbeat = config.getBroadcasterFactory().lookup(DefaultBroadcaster.class, "/swaggersocket.heartbeat"); if (heartbeat == null) { heartbeat = config.getBroadcasterFactory().get(DefaultBroadcaster.class, "/swaggersocket.heartbeat"); } lazywrite = config.getInitParameter("io.swagger.swaggersocket.protocol.lazywrite", false); emptyentity = config.getInitParameter("io.swagger.swaggersocket.protocol.emptyentity", false); String p = config.getInitParameter("io.swagger.swaggersocket.protocol.includedheaders"); if (p != null) { includedheaders = Pattern.compile(p, Pattern.CASE_INSENSITIVE); } p = config.getInitParameter("io.swagger.swaggersocket.protocol.excludedheaders"); if (p != null) { excludedheaders = Pattern.compile(p, Pattern.CASE_INSENSITIVE); } }
@Ready public void onReady(AtmosphereResource resource) throws Exception { factory = resource.getAtmosphereConfig().getBroadcasterFactory(); resourceFactory = resource.getAtmosphereConfig().resourcesFactory(); notificationService = (NotificationService) resource.getAtmosphereConfig().getServletContext().getAttribute(AtmosphereModule.NOTIFICATION_SERVICE); if(!notificationService.subscribe(topicName, resource)) { logger.debug("Subscription to topic {} refused (resource: {})", topicName, resource); close(resource); } }
BroadcasterFactory broadcasterFactory = r.getAtmosphereConfig().getBroadcasterFactory();
newBroadcaster = config.getBroadcasterFactory().lookup(broadcasterName, true); newBroadcaster.setBroadcasterLifeCyclePolicy(BroadcasterLifeCyclePolicy.EMPTY_DESTROY); throw new IllegalStateException(e.getMessage()); broadcaster = config.getBroadcasterFactory().lookup(c, topic, true); throw new IllegalStateException(e.getMessage()); r.setBroadcaster(config.getBroadcasterFactory().lookup(c, topic, true));
/** * Creates channel (named {@link Broadcaster} in Atmosphere) based on the {@link org.atmosphere.cpr.AtmosphereRequest#getPathInfo()} * * @param resource An {@link AtmosphereResource} * @return */ public boolean apply(AtmosphereResource resource) { String pathInfo = resource.getRequest().getPathInfo(); BroadcasterFactory f = resource.getAtmosphereConfig().getBroadcasterFactory(); if (pathInfo == null) { resource.setBroadcaster(f.lookup("/*")); return true; } final Broadcaster b = f.lookup(pathInfo, true); resource.setBroadcaster(b); return true; } }