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


Java JSR356AsyncSupport类代码示例

本文整理汇总了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();
}
 
开发者ID:JumpMind,项目名称:sqlexplorer-vaadin,代码行数:23,代码来源:DemoUI.java

示例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("/*");
}
 
开发者ID:JumpMind,项目名称:metl,代码行数:30,代码来源:AppInitializer.java


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