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


Java ApplicationConfig类代码示例

本文整理汇总了Java中org.atmosphere.cpr.ApplicationConfig的典型用法代码示例。如果您正苦于以下问题:Java ApplicationConfig类的具体用法?Java ApplicationConfig怎么用?Java ApplicationConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ApplicationConfig类属于org.atmosphere.cpr包,在下文中一共展示了ApplicationConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: WebsocketConsumer

import org.atmosphere.cpr.ApplicationConfig; //导入依赖的package包/类
public WebsocketConsumer(WebsocketEndpoint endpoint, Processor processor) {
    super(endpoint, processor);
    this.framework = new AtmosphereFramework(false, true);

    framework.setUseNativeImplementation(false);
    framework.addInitParameter(ApplicationConfig.WEBSOCKET_SUPPORT, "true");
    framework.addInitParameter(ApplicationConfig.WEBSOCKET_PROTOCOL, 
        endpoint.isUseStreaming() ? WebsocketStreamHandler.class.getName() : WebsocketHandler.class.getName());
    //REVISIT we need to disable JSR356 detection for now when using jetty-9.3 when using atmosphere-2.4.x
    framework.addInitParameter(ApplicationConfig.WEBSOCKET_SUPPRESS_JSR356, "true");
    framework.init();
    
    WebSocketProtocol wsp = framework.getWebSocketProtocol();
    if (wsp instanceof WebsocketHandler) {
        ((WebsocketHandler)wsp).setConsumer(this);            
    } else {
        throw new IllegalArgumentException("Unexpected WebSocketHandler: " + wsp);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:20,代码来源:WebsocketConsumer.java

示例2: contextInitialized

import org.atmosphere.cpr.ApplicationConfig; //导入依赖的package包/类
@Override
public void contextInitialized(ServletContextEvent event) {
  Injector injector = Guice.createInjector(new GuiceModule());
  Server server = injector.getInstance(Server.class);

  HttpTransportServer httpTransportServer = new HttpTransportServer().ontransport(server);
  WebSocketTransportServer wsTransportServer = new WebSocketTransportServer().ontransport(server);

  // Installs the server on Atmosphere platform
  ServletContext context = event.getServletContext();
  Servlet servlet = new AsityAtmosphereServlet().onhttp(httpTransportServer).onwebsocket
    (wsTransportServer);
  ServletRegistration.Dynamic reg = context.addServlet(AsityAtmosphereServlet.class.getName(),
    servlet);
  reg.setAsyncSupported(true);
  reg.setInitParameter(ApplicationConfig.DISABLE_ATMOSPHEREINTERCEPTOR, Boolean.TRUE.toString());
  reg.addMapping("/cettia");
  // Start scheduler
  injector.getInstance(Clock.class).init();
}
 
开发者ID:cettia,项目名称:cettia-examples,代码行数:21,代码来源:Bootstrap.java

示例3: contextInitialized

import org.atmosphere.cpr.ApplicationConfig; //导入依赖的package包/类
@Override
public void contextInitialized(ServletContextEvent event) {
  ObjectGraph objectGraph = ObjectGraph.create(new DaggerModule());
  objectGraph.inject(this);

  HttpTransportServer httpTransportServer = new HttpTransportServer().ontransport(server);
  WebSocketTransportServer wsTransportServer = new WebSocketTransportServer().ontransport(server);

  // Installs the server on Atmosphere platform
  ServletContext context = event.getServletContext();
  Servlet servlet = new AsityAtmosphereServlet().onhttp(httpTransportServer).onwebsocket
    (wsTransportServer);
  ServletRegistration.Dynamic reg = context.addServlet(AsityAtmosphereServlet.class.getName(),
    servlet);
  reg.setAsyncSupported(true);
  reg.setInitParameter(ApplicationConfig.DISABLE_ATMOSPHEREINTERCEPTOR, Boolean.TRUE.toString());
  reg.addMapping("/cettia");
  // Start scheduler
  clock.init();
}
 
开发者ID:cettia,项目名称:cettia-examples,代码行数:21,代码来源:Bootstrap.java

示例4: contextInitialized

import org.atmosphere.cpr.ApplicationConfig; //导入依赖的package包/类
@Override
public void contextInitialized(ServletContextEvent event) {
  ServiceLocator locator = ServiceLocatorUtilities.createAndPopulateServiceLocator();
  ServiceLocatorUtilities.enableImmediateScope(locator);
  Server server = locator.getService(Server.class);

  HttpTransportServer httpTransportServer = new HttpTransportServer().ontransport(server);
  WebSocketTransportServer wsTransportServer = new WebSocketTransportServer().ontransport(server);

  // Installs the server on Atmosphere platform
  ServletContext context = event.getServletContext();
  Servlet servlet = new AsityAtmosphereServlet().onhttp(httpTransportServer).onwebsocket
    (wsTransportServer);
  ServletRegistration.Dynamic reg = context.addServlet(AsityAtmosphereServlet.class.getName(),
    servlet);
  reg.setAsyncSupported(true);
  reg.setInitParameter(ApplicationConfig.DISABLE_ATMOSPHEREINTERCEPTOR, Boolean.TRUE.toString());
  reg.addMapping("/cettia");
}
 
开发者ID:cettia,项目名称:cettia-examples,代码行数:20,代码来源:Bootstrap.java

示例5: contextInitialized

import org.atmosphere.cpr.ApplicationConfig; //导入依赖的package包/类
@Override
public void contextInitialized(ServletContextEvent event) {
  RegistryBuilder builder = new RegistryBuilder();
  builder.add(TapestryModule.class);
  Registry registry = builder.build();
  registry.performRegistryStartup();
  final Server server = registry.getService(Server.class);

  HttpTransportServer httpTransportServer = new HttpTransportServer().ontransport(server);
  WebSocketTransportServer wsTransportServer = new WebSocketTransportServer().ontransport(server);

  // Installs the server on Atmosphere platform
  ServletContext context = event.getServletContext();
  Servlet servlet = new AsityAtmosphereServlet().onhttp(httpTransportServer).onwebsocket
    (wsTransportServer);
  ServletRegistration.Dynamic reg = context.addServlet(AsityAtmosphereServlet.class.getName(),
    servlet);
  reg.setAsyncSupported(true);
  reg.setInitParameter(ApplicationConfig.DISABLE_ATMOSPHEREINTERCEPTOR, Boolean.TRUE.toString());
  reg.addMapping("/cettia");
}
 
开发者ID:cettia,项目名称:cettia-examples,代码行数:22,代码来源:Bootstrap.java

示例6: contextInitialized

import org.atmosphere.cpr.ApplicationConfig; //导入依赖的package包/类
@Override
@SuppressWarnings({"resource"})
public void contextInitialized(ServletContextEvent event) {
  AnnotationConfigApplicationContext applicationContext = new
    AnnotationConfigApplicationContext(SpringConfig.class);
  Server server = applicationContext.getBean(Server.class);

  HttpTransportServer httpTransportServer = new HttpTransportServer().ontransport(server);
  WebSocketTransportServer wsTransportServer = new WebSocketTransportServer().ontransport(server);

  // Installs the server on Atmosphere platform
  ServletContext context = event.getServletContext();
  Servlet servlet = new AsityAtmosphereServlet().onhttp(httpTransportServer).onwebsocket
    (wsTransportServer);
  ServletRegistration.Dynamic reg = context.addServlet(AsityAtmosphereServlet.class.getName(),
    servlet);
  reg.setAsyncSupported(true);
  reg.setInitParameter(ApplicationConfig.DISABLE_ATMOSPHEREINTERCEPTOR, Boolean.TRUE.toString());
  reg.addMapping("/cettia");
}
 
开发者ID:cettia,项目名称:cettia-examples,代码行数:21,代码来源:Bootstrap.java

示例7: startServer

import org.atmosphere.cpr.ApplicationConfig; //导入依赖的package包/类
@Override
protected void startServer() throws Exception {
    server = new Server();
    ServerConnector connector = new ServerConnector(server);
    connector.setPort(port);
    server.addConnector(connector);
    ServletContextHandler handler = new ServletContextHandler();
    handler.addEventListener(new ServletContextListener() {
        @Override
        public void contextInitialized(ServletContextEvent event) {
            ServletContext context = event.getServletContext();
            Servlet servlet = new VibeAtmosphereServlet().onhttp(performer.serverAction());
            ServletRegistration.Dynamic reg = context.addServlet(VibeAtmosphereServlet.class.getName(), servlet);
            reg.setAsyncSupported(true);
            reg.setInitParameter(ApplicationConfig.DISABLE_ATMOSPHEREINTERCEPTOR, Boolean.TRUE.toString());
            reg.addMapping("/test");
        }

        @Override
        public void contextDestroyed(ServletContextEvent sce) {}
    });
    server.setHandler(handler);
    server.start();
}
 
开发者ID:vibe-project,项目名称:vibe-java-platform,代码行数:25,代码来源:AtmosphereServerHttpExchangeTest.java

示例8: startServer

import org.atmosphere.cpr.ApplicationConfig; //导入依赖的package包/类
@Override
protected void startServer() throws Exception {
    server = new Server();
    ServerConnector connector = new ServerConnector(server);
    connector.setPort(port);
    server.addConnector(connector);
    ServletContextHandler handler = new ServletContextHandler();
    handler.addEventListener(new ServletContextListener() {
        @Override
        public void contextInitialized(ServletContextEvent event) {
            ServletContext context = event.getServletContext();
            Servlet servlet = new VibeAtmosphereServlet().onwebsocket(performer.serverAction());
            ServletRegistration.Dynamic reg = context.addServlet(VibeAtmosphereServlet.class.getName(), servlet);
            reg.setAsyncSupported(true);
            reg.setInitParameter(ApplicationConfig.DISABLE_ATMOSPHEREINTERCEPTOR, Boolean.TRUE.toString());
            reg.addMapping("/test");
        }

        @Override
        public void contextDestroyed(ServletContextEvent sce) {}
    });
    server.setHandler(handler);
    server.start();
}
 
开发者ID:vibe-project,项目名称:vibe-java-platform,代码行数:25,代码来源:AtmosphereServerWebSocketTest.java

示例9: contextInitialized

import org.atmosphere.cpr.ApplicationConfig; //导入依赖的package包/类
@Override
public void contextInitialized(ServletContextEvent event) {
    Injector injector = Guice.createInjector(new GuiceModule());
    Server server = injector.getInstance(Server.class);

    HttpTransportServer httpTransportServer = new HttpTransportServer().transportAction(server);
    WebSocketTransportServer wsTransportServer = new WebSocketTransportServer().transportAction(server);

    // Installs the server on Atmosphere platform
    ServletContext context = event.getServletContext();
    Servlet servlet = new VibeAtmosphereServlet().httpAction(httpTransportServer).wsAction(wsTransportServer);
    ServletRegistration.Dynamic reg = context.addServlet(VibeAtmosphereServlet.class.getName(), servlet);
    reg.setAsyncSupported(true);
    reg.setInitParameter(ApplicationConfig.DISABLE_ATMOSPHEREINTERCEPTOR, Boolean.TRUE.toString());
    reg.addMapping("/vibe");
    // Start scheduler
    injector.getInstance(Clock.class).init();
}
 
开发者ID:vibe-project,项目名称:vibe-examples,代码行数:19,代码来源:Bootstrap.java

示例10: contextInitialized

import org.atmosphere.cpr.ApplicationConfig; //导入依赖的package包/类
@Override
public void contextInitialized(ServletContextEvent event) {
    ObjectGraph objectGraph = ObjectGraph.create(new DaggerModule());
    objectGraph.inject(this);

    HttpTransportServer httpTransportServer = new HttpTransportServer().transportAction(server);
    WebSocketTransportServer wsTransportServer = new WebSocketTransportServer().transportAction(server);

    // Installs the server on Atmosphere platform
    ServletContext context = event.getServletContext();
    Servlet servlet = new VibeAtmosphereServlet().httpAction(httpTransportServer).wsAction(wsTransportServer);
    ServletRegistration.Dynamic reg = context.addServlet(VibeAtmosphereServlet.class.getName(), servlet);
    reg.setAsyncSupported(true);
    reg.setInitParameter(ApplicationConfig.DISABLE_ATMOSPHEREINTERCEPTOR, Boolean.TRUE.toString());
    reg.addMapping("/vibe");
    // Start scheduler
    clock.init();
}
 
开发者ID:vibe-project,项目名称:vibe-examples,代码行数:19,代码来源:Bootstrap.java

示例11: contextInitialized

import org.atmosphere.cpr.ApplicationConfig; //导入依赖的package包/类
@Override
public void contextInitialized(ServletContextEvent event) {
    ServiceLocator locator = ServiceLocatorUtilities.createAndPopulateServiceLocator();
    ServiceLocatorUtilities.enableImmediateScope(locator);
    Server server = locator.getService(Server.class);
    
    HttpTransportServer httpTransportServer = new HttpTransportServer().transportAction(server);
    WebSocketTransportServer wsTransportServer = new WebSocketTransportServer().transportAction(server);

    // Installs the server on Atmosphere platform
    ServletContext context = event.getServletContext();
    Servlet servlet = new VibeAtmosphereServlet().httpAction(httpTransportServer).wsAction(wsTransportServer);
    ServletRegistration.Dynamic reg = context.addServlet(VibeAtmosphereServlet.class.getName(), servlet);
    reg.setAsyncSupported(true);
    reg.setInitParameter(ApplicationConfig.DISABLE_ATMOSPHEREINTERCEPTOR, Boolean.TRUE.toString());
    reg.addMapping("/vibe");
}
 
开发者ID:vibe-project,项目名称:vibe-examples,代码行数:18,代码来源:Bootstrap.java

示例12: contextInitialized

import org.atmosphere.cpr.ApplicationConfig; //导入依赖的package包/类
@Override
public void contextInitialized(ServletContextEvent event) {
    RegistryBuilder builder = new RegistryBuilder();
    builder.add(TapestryModule.class);
    Registry registry = builder.build();
    registry.performRegistryStartup();        
    final Server server = registry.getService(Server.class);
    
    HttpTransportServer httpTransportServer = new HttpTransportServer().transportAction(server);
    WebSocketTransportServer wsTransportServer = new WebSocketTransportServer().transportAction(server);
    
    // Installs the server on Atmosphere platform
    ServletContext context = event.getServletContext();
    Servlet servlet = new VibeAtmosphereServlet().httpAction(httpTransportServer).wsAction(wsTransportServer);
    ServletRegistration.Dynamic reg = context.addServlet(VibeAtmosphereServlet.class.getName(), servlet);
    reg.setAsyncSupported(true);
    reg.setInitParameter(ApplicationConfig.DISABLE_ATMOSPHEREINTERCEPTOR, Boolean.TRUE.toString());
    reg.addMapping("/vibe");
}
 
开发者ID:vibe-project,项目名称:vibe-examples,代码行数:20,代码来源:Bootstrap.java

示例13: contextInitialized

import org.atmosphere.cpr.ApplicationConfig; //导入依赖的package包/类
@Override
@SuppressWarnings({ "resource" })
public void contextInitialized(ServletContextEvent event) {
    AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(SpringConfig.class);
    Server server = applicationContext.getBean(Server.class);
    
    HttpTransportServer httpTransportServer = new HttpTransportServer().transportAction(server);
    WebSocketTransportServer wsTransportServer = new WebSocketTransportServer().transportAction(server);

    // Installs the server on Atmosphere platform
    ServletContext context = event.getServletContext();
    Servlet servlet = new VibeAtmosphereServlet().httpAction(httpTransportServer).wsAction(wsTransportServer);
    ServletRegistration.Dynamic reg = context.addServlet(VibeAtmosphereServlet.class.getName(), servlet);
    reg.setAsyncSupported(true);
    reg.setInitParameter(ApplicationConfig.DISABLE_ATMOSPHEREINTERCEPTOR, Boolean.TRUE.toString());
    reg.addMapping("/vibe");
}
 
开发者ID:vibe-project,项目名称:vibe-examples,代码行数:18,代码来源:Bootstrap.java

示例14: query

import org.atmosphere.cpr.ApplicationConfig; //导入依赖的package包/类
@POST
public void query(String permission) {
    if (api != null) {
        AtmosphereResource r = (AtmosphereResource) request.getAttribute(ApplicationConfig.ATMOSPHERE_RESOURCE);
        if (r != null) {
            Subject sub = (Subject) r.getRequest().getAttribute(FrameworkConfig.SECURITY_SUBJECT);
            User u = api.getAuth().getUser(sub.getPrincipal().toString());
            Boolean permOK = u.isPermitted(permission);
            PermissionCheckRepresentation p = new PermissionCheckRepresentation(u.getName(), permission, permOK);
            try {
                r.getResponse().write(om.writeValueAsString(p));
            } catch (JsonProcessingException ex) {
            }
        } else {
            throw new IllegalStateException();
        }
    }
}
 
开发者ID:freedomotic,项目名称:freedomotic,代码行数:19,代码来源:AtmospherePermissionCheckResource.java

示例15: initAtmosphere

import org.atmosphere.cpr.ApplicationConfig; //导入依赖的package包/类
private AtmosphereCoordinator initAtmosphere(Router router, VertxVaadinService service) {
    final String bufferSize = String.valueOf(PushConstants.WEBSOCKET_BUFFER_SIZE);

    AtmosphereInterceptor trackMessageSize = new TrackMessageSizeInterceptor();

    VertxAtmosphere.Builder pushBuilder = new VertxAtmosphere.Builder()
        .initParam(ApplicationConfig.BROADCASTER_CACHE, UUIDBroadcasterCache.class.getName())
        .initParam(ApplicationConfig.ANNOTATION_PROCESSOR, VoidAnnotationProcessor.class.getName())
        .initParam(ApplicationConfig.PROPERTY_SESSION_SUPPORT, "true")
        .initParam(ApplicationConfig.MESSAGE_DELIMITER, String.valueOf(PushConstants.MESSAGE_DELIMITER))
        .initParam(ApplicationConfig.DROP_ACCESS_CONTROL_ALLOW_ORIGIN_HEADER, "false")
        // Disable heartbeat (it does not emit correct events client side)
        // https://github.com/Atmosphere/atmosphere-javascript/issues/141
        .initParam(ApplicationConfig.DISABLE_ATMOSPHEREINTERCEPTORS, HeartbeatInterceptor.class.getName())
        .initParam(ApplicationConfig.WEBSOCKET_BUFFER_SIZE, bufferSize)
        .initParam(ApplicationConfig.WEBSOCKET_MAXTEXTSIZE, bufferSize)
        .initParam(ApplicationConfig.WEBSOCKET_MAXBINARYSIZE, bufferSize)
        .initParam(ApplicationConfig.PROPERTY_ALLOW_SESSION_TIMEOUT_REMOVAL, "false")
        // Disable Atmosphere's message about commercial support
        .initParam("org.atmosphere.cpr.showSupportMessage", "false")
        .interceptor(trackMessageSize);

    AtmosphereCoordinator atmosphereCoordinator = ExposeAtmosphere.newCoordinator(pushBuilder);
    AtmosphereFramework framework = atmosphereCoordinator.framework();
    trackMessageSize.configure(framework.getAtmosphereConfig());

    VertxPushHandler vertxPushHandler = new VertxPushHandler(service);
    vertxPushHandler.setLongPollingSuspendTimeout(framework.getAtmosphereConfig()
        .getInitParameter(com.vaadin.server.Constants.SERVLET_PARAMETER_PUSH_SUSPEND_TIMEOUT_LONGPOLLING, -1));

    PushAtmosphereHandler pushAtmosphereHandler = new PushAtmosphereHandler();
    pushAtmosphereHandler.setPushHandler(vertxPushHandler);
    framework.addAtmosphereHandler("/*", pushAtmosphereHandler);

    atmosphereCoordinator.ready();

    service.addServiceDestroyListener(event -> atmosphereCoordinator.shutdown());

    return atmosphereCoordinator;
}
 
开发者ID:mcollovati,项目名称:vaadin-vertx-samples,代码行数:41,代码来源:VertxVaadin.java


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