本文整理汇总了Java中org.atmosphere.cpr.AtmosphereServlet类的典型用法代码示例。如果您正苦于以下问题:Java AtmosphereServlet类的具体用法?Java AtmosphereServlet怎么用?Java AtmosphereServlet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AtmosphereServlet类属于org.atmosphere.cpr包,在下文中一共展示了AtmosphereServlet类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initAtmosphereServlet
import org.atmosphere.cpr.AtmosphereServlet; //导入依赖的package包/类
/**
* Initializes Atmosphere.
*/
private void initAtmosphereServlet(ServletContext servletContext) {
log.debug("Registering Atmosphere Servlet");
AtmosphereServlet servlet = new AtmosphereServlet();
Field frameworkField = ReflectionUtils.findField(AtmosphereServlet.class, "framework");
ReflectionUtils.makeAccessible(frameworkField);
NoAnalyticsAtmosphereFramework atmosphereFramework = new NoAnalyticsAtmosphereFramework();
ReflectionUtils.setField(frameworkField, servlet, atmosphereFramework);
ServletRegistration.Dynamic atmosphereServlet =
servletContext.addServlet("atmosphereServlet", servlet);
servletContext.setAttribute("AtmosphereServlet", atmosphereFramework);
atmosphereServlet.setInitParameter("org.atmosphere.cpr.packages", "com.jittrack.gts.web.websocket");
atmosphereServlet.setInitParameter("org.atmosphere.cpr.broadcasterCacheClass", UUIDBroadcasterCache.class.getName());
atmosphereServlet.setInitParameter("org.atmosphere.cpr.broadcaster.shareableThreadPool", "true");
atmosphereServlet.setInitParameter("org.atmosphere.cpr.broadcaster.maxProcessingThreads", "10");
atmosphereServlet.setInitParameter("org.atmosphere.cpr.broadcaster.maxAsyncWriteThreads", "10");
servletContext.addListener(new org.atmosphere.cpr.SessionSupport());
atmosphereServlet.addMapping("/websocket/*");
atmosphereServlet.setLoadOnStartup(3);
atmosphereServlet.setAsyncSupported(true);
}
示例2: initAtmosphereServlet
import org.atmosphere.cpr.AtmosphereServlet; //导入依赖的package包/类
/**
* Initializes Atmosphere.
*/
private void initAtmosphereServlet(ServletContext servletContext) {
log.debug("Registering Atmosphere Servlet");
AtmosphereServlet servlet = new AtmosphereServlet();
Field frameworkField = ReflectionUtils.findField(AtmosphereServlet.class, "framework");
ReflectionUtils.makeAccessible(frameworkField);
ReflectionUtils.setField(frameworkField, servlet, new NoAnalyticsAtmosphereFramework());
ServletRegistration.Dynamic atmosphereServlet =
servletContext.addServlet("atmosphereServlet", servlet);
atmosphereServlet.setInitParameter("org.atmosphere.cpr.packages", "ch.ithings.demo.web.websocket");
atmosphereServlet.setInitParameter("org.atmosphere.cpr.broadcasterCacheClass", UUIDBroadcasterCache.class.getName());
atmosphereServlet.setInitParameter("org.atmosphere.cpr.broadcaster.shareableThreadPool", "true");
atmosphereServlet.setInitParameter("org.atmosphere.cpr.broadcaster.maxProcessingThreads", "10");
atmosphereServlet.setInitParameter("org.atmosphere.cpr.broadcaster.maxAsyncWriteThreads", "10");
servletContext.addListener(new org.atmosphere.cpr.SessionSupport());
atmosphereServlet.addMapping("/websocket/*");
atmosphereServlet.setLoadOnStartup(3);
atmosphereServlet.setAsyncSupported(true);
}
示例3: initAtmosphereServlet
import org.atmosphere.cpr.AtmosphereServlet; //导入依赖的package包/类
/**
* Initializes Atmosphere.
*/
private void initAtmosphereServlet(ServletContext servletContext) {
log.debug("Registering Atmosphere Servlet");
AtmosphereServlet servlet = new AtmosphereServlet();
Field frameworkField = ReflectionUtils.findField(AtmosphereServlet.class, "framework");
ReflectionUtils.makeAccessible(frameworkField);
ReflectionUtils.setField(frameworkField, servlet, new NoAnalyticsAtmosphereFramework());
ServletRegistration.Dynamic atmosphereServlet =
servletContext.addServlet("atmosphereServlet", servlet);
atmosphereServlet.setInitParameter("org.atmosphere.cpr.packages", "com.mycompany.myapp.web.websocket");
atmosphereServlet.setInitParameter("org.atmosphere.cpr.broadcasterCacheClass", UUIDBroadcasterCache.class.getName());
atmosphereServlet.setInitParameter("org.atmosphere.cpr.broadcaster.shareableThreadPool", "true");
atmosphereServlet.setInitParameter("org.atmosphere.cpr.broadcaster.maxProcessingThreads", "10");
atmosphereServlet.setInitParameter("org.atmosphere.cpr.broadcaster.maxAsyncWriteThreads", "10");
atmosphereServlet.addMapping("/websocket/*");
atmosphereServlet.setLoadOnStartup(3);
atmosphereServlet.setAsyncSupported(true);
}
示例4: atmosphereServlet
import org.atmosphere.cpr.AtmosphereServlet; //导入依赖的package包/类
@Bean
public AtmosphereServlet atmosphereServlet() {
return new AtmosphereServlet();
}
示例5: servletRegistrationBean
import org.atmosphere.cpr.AtmosphereServlet; //导入依赖的package包/类
@Bean // for socket.io
public ServletRegistrationBean servletRegistrationBean() {
ServletRegistrationBean bean = new ServletRegistrationBean(new AtmosphereServlet(), "/coding-ide-tty1/*");
bean.addInitParameter("socketio-transport", "websocket");
bean.addInitParameter("socketio-timeout", "25000");
bean.addInitParameter("socketio-heartbeat", "15000");
bean.addInitParameter("socketio-suspendTime", "30000");
bean.addInitParameter("org.atmosphere.cpr.sessionSupport", "true");
bean.addInitParameter("SPACE_HOME", spaceHome);
bean.setLoadOnStartup(100);
bean.setAsyncSupported(true);
return bean;
}
示例6: atmosphereServlet
import org.atmosphere.cpr.AtmosphereServlet; //导入依赖的package包/类
@Bean
public ServletRegistrationBean atmosphereServlet() {
// Dispatcher servlet is mapped to '/home' to allow the AtmosphereServlet
// to be mapped to '/chat'
ServletRegistrationBean registration = new ServletRegistrationBean(
new AtmosphereServlet(), "/chat/*");
registration.addInitParameter("org.atmosphere.cpr.packages", "sample");
registration.addInitParameter("org.atmosphere.interceptor.HeartbeatInterceptor"
+ ".clientHeartbeatFrequencyInSeconds", "10");
registration.setLoadOnStartup(0);
// Need to occur before the EmbeddedAtmosphereInitializer
registration.setOrder(Ordered.HIGHEST_PRECEDENCE);
return registration;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:SampleAtmosphereApplication.java
示例7: onStartup
import org.atmosphere.cpr.AtmosphereServlet; //导入依赖的package包/类
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
super.onStartup(servletContext);
ServletRegistration.Dynamic atmosphereServletRegistration = servletContext.addServlet("atmosphereServlet",
AtmosphereServlet.class);
atmosphereServletRegistration.setAsyncSupported(true);
atmosphereServletRegistration.addMapping("/" + ATMOSPHERE_URL + "/*");
atmosphereServletRegistration.setLoadOnStartup(1);
}
示例8: registerAtmosphere
import org.atmosphere.cpr.AtmosphereServlet; //导入依赖的package包/类
private void registerAtmosphere(Environment environment, Clock clock) {
AtmosphereServlet servlet = new AtmosphereServlet();
servlet.framework().addInitParameter(ApplicationConfig.ANNOTATION_PACKAGE, WebSocketHandler.class.getPackage().getName());
servlet.framework().addInitParameter(ApplicationConfig.WEBSOCKET_SUPPORT, "true");
ServletRegistration.Dynamic registration = environment.servlets().addServlet("atmosphere", servlet);
registration.addMapping(WEBSOCKET_SERVLET_MAPPING);
BroadcasterFactory broadcasterFactory = servlet.framework().getBroadcasterFactory();
clock.setNextRoundCallback(round -> WebSocketHandler.broadcastRound(broadcasterFactory, round));
}
示例9: configureAthmosphere
import org.atmosphere.cpr.AtmosphereServlet; //导入依赖的package包/类
private void configureAthmosphere(AtmosphereServlet servlet, ServletContext servletContext) {
ServletRegistration.Dynamic atmosphereServlet = servletContext.addServlet("atmosphereServlet", servlet);
atmosphereServlet.setInitParameter(ApplicationConfig.ANNOTATION_PACKAGE, ToastService.class.getPackage().getName());
atmosphereServlet.setInitParameter(ApplicationConfig.BROADCASTER_CACHE, UUIDBroadcasterCache.class.getName());
atmosphereServlet.setInitParameter(ApplicationConfig.BROADCASTER_SHARABLE_THREAD_POOLS, "true");
atmosphereServlet.setInitParameter(ApplicationConfig.BROADCASTER_MESSAGE_PROCESSING_THREADPOOL_MAXSIZE, "10");
atmosphereServlet.setInitParameter(ApplicationConfig.BROADCASTER_ASYNC_WRITE_THREADPOOL_MAXSIZE, "10");
servletContext.addListener(new org.atmosphere.cpr.SessionSupport());
atmosphereServlet.addMapping("/websocket/*");
atmosphereServlet.setLoadOnStartup(0);
atmosphereServlet.setAsyncSupported(true);
}