当前位置: 首页>>代码示例>>Java>>正文


Java AtmosphereServlet类代码示例

本文整理汇总了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);
}
 
开发者ID:sanketbajoria,项目名称:jittrackGTS,代码行数:27,代码来源:WebConfigurer.java

示例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);
}
 
开发者ID:thpham,项目名称:ithings-demo,代码行数:24,代码来源:WebConfigurer.java

示例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);
}
 
开发者ID:ravikiran438,项目名称:cevent-app,代码行数:23,代码来源:WebConfigurer.java

示例4: atmosphereServlet

import org.atmosphere.cpr.AtmosphereServlet; //导入依赖的package包/类
@Bean
public AtmosphereServlet atmosphereServlet() {
  return new AtmosphereServlet();
}
 
开发者ID:AndreasKl,项目名称:springboot-angular-atmosphere-quickstart,代码行数:5,代码来源:WebConfigurer.java

示例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;
}
 
开发者ID:Coding,项目名称:WebIDE-Backend,代码行数:16,代码来源:WebSocketConfig.java

示例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);
}
 
开发者ID:janScheible,项目名称:knorxx,代码行数:11,代码来源:KnorxxDispatcherServletInitializer.java

示例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));
}
 
开发者ID:phxql,项目名称:restwars,代码行数:12,代码来源:RestwarsApplication.java

示例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);
}
 
开发者ID:AndreasKl,项目名称:springboot-angular-atmosphere-quickstart,代码行数:13,代码来源:WebConfigurer.java


注:本文中的org.atmosphere.cpr.AtmosphereServlet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。