本文整理汇总了Java中org.atmosphere.container.JSR356AsyncSupport类的典型用法代码示例。如果您正苦于以下问题:Java JSR356AsyncSupport类的具体用法?Java JSR356AsyncSupport怎么用?Java JSR356AsyncSupport使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JSR356AsyncSupport类属于org.atmosphere.container包,在下文中一共展示了JSR356AsyncSupport类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.atmosphere.container.JSR356AsyncSupport; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
SLF4JBridgeHandler.removeHandlersForRootLogger();
SLF4JBridgeHandler.install();
Server server = new Server(9090);
ClassList classlist = Configuration.ClassList.setServerDefault(server);
classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration", "org.eclipse.jetty.annotations.AnnotationConfiguration");
WebAppContext webapp = new WebAppContext();
webapp.setParentLoaderPriority(true);
webapp.setConfigurationDiscovered(true);
webapp.setContextPath("/");
webapp.setResourceBase("src/main/webapp");
webapp.setWar("src/main/webapp");
ServletHolder servletHolder = webapp.addServlet(DemoUIServlet.class, "/*");
servletHolder.setAsyncSupported(true);
servletHolder.setInitParameter("org.atmosphere.cpr.asyncSupport", JSR356AsyncSupport.class.getName());
server.setHandler(webapp);
ServerContainer webSocketServer = WebSocketServerContainerInitializer.configureContext(webapp);
webSocketServer.setDefaultMaxSessionIdleTimeout(10000000);
server.start();
log.info("Browse http://localhost:9090 to see the demo");
server.join();
}
示例2: onStartup
import org.atmosphere.container.JSR356AsyncSupport; //导入依赖的package包/类
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
System.out.println("Version: " + VersionUtils.getCurrentVersion());
properties = loadProperties();
LogUtils.initLogging(getConfigDir(false), (TypedProperties) properties);
AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext();
applicationContext.scan("org.jumpmind.metl");
MutablePropertySources sources = applicationContext.getEnvironment().getPropertySources();
sources.addLast(new PropertiesPropertySource("passed in properties", properties));
servletContext.addListener(new ContextLoaderListener(applicationContext));
servletContext.addListener(this);
servletContext.addListener(new RequestContextListener());
AnnotationConfigWebApplicationContext dispatchContext = new AnnotationConfigWebApplicationContext();
dispatchContext.setParent(applicationContext);
ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher", new DispatcherServlet(dispatchContext));
dispatcher.setLoadOnStartup(1);
dispatcher.addMapping("/api/*");
applicationContextRef.set(dispatchContext);
ServletRegistration.Dynamic apidocs = servletContext.addServlet("docs", DefaultServlet.class);
apidocs.addMapping("/api.html", "/ws-api.html", "/doc/*", "/ace/*");
ServletRegistration.Dynamic vaadin = servletContext.addServlet("vaadin", AppServlet.class);
vaadin.setAsyncSupported(true);
vaadin.setInitParameter("org.atmosphere.cpr.asyncSupport", JSR356AsyncSupport.class.getName());
vaadin.setInitParameter("beanName", "appUI");
vaadin.addMapping("/*");
}