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


Java Server.addBean方法代码示例

本文整理汇总了Java中org.eclipse.jetty.server.Server.addBean方法的典型用法代码示例。如果您正苦于以下问题:Java Server.addBean方法的具体用法?Java Server.addBean怎么用?Java Server.addBean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jetty.server.Server的用法示例。


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

示例1: compose

import org.eclipse.jetty.server.Server; //导入方法依赖的package包/类
public static void compose(Server server) {
    //Servlets + Guice
    ServletContextHandler servletContextHandler = new ServletContextHandler(server, "/", ServletContextHandler.SESSIONS);
    servletContextHandler.addFilter(GuiceFilter.class, "/*", EnumSet.allOf(DispatcherType.class));
    servletContextHandler.addServlet(DefaultServlet.class, "/");

    //JMX stuff...
    MBeanContainer mbContainer = new MBeanContainer(ManagementFactory.getPlatformMBeanServer());
    server.addEventListener(mbContainer);
    server.addBean(mbContainer);
    server.addBean(Log.getLog());
}
 
开发者ID:Sixt,项目名称:ja-micro,代码行数:13,代码来源:JettyComposer.java

示例2: startServer

import org.eclipse.jetty.server.Server; //导入方法依赖的package包/类
public static void startServer() throws ServletException {
    QueuedThreadPool threadPool = new QueuedThreadPool(10);
    threadPool.setDaemon(true);
    threadPool.setMaxThreads(10);
    Server server = new Server(threadPool);
    server.addBean(new ScheduledExecutorScheduler("JettyScheduler", true), true);
    ServerConnector http = new ServerConnector(server, new HttpConnectionFactory());
    http.setPort(2992);
    server.addConnector(http);

    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setContextPath("/");
    context.setBaseResource(Resource.newClassPathResource("/org/lwjglx/debug/static"));
    context.setWelcomeFiles(new String[] { "index.html" });
    server.setHandler(context);

    WebSocketUpgradeFilter wsfilter = WebSocketUpgradeFilter.configureContext(context);
    // wsfilter.getFactory().getPolicy().setIdleTimeout(5000);
    wsfilter.addMapping(new ServletPathSpec("/ws"), new ProfilingConnectionCreator());

    ServletHolder holderDefault = new ServletHolder("default", DefaultServlet.class);
    holderDefault.setInitParameter("dirAllowed", "true");
    context.addServlet(holderDefault, "/");

    try {
        server.start();
    } catch (Exception e) {
        throw new AssertionError("Could not start profiling server", e);
    }
}
 
开发者ID:LWJGLX,项目名称:debug,代码行数:31,代码来源:Profiling.java

示例3: configureBasicAuthentication

import org.eclipse.jetty.server.Server; //导入方法依赖的package包/类
protected ConstraintSecurityHandler configureBasicAuthentication(Server server,
    ServerConnector connector, AvaticaServerConfiguration config) {
  final String[] allowedRoles = config.getAllowedRoles();
  final String realm = config.getHashLoginServiceRealm();
  final String loginServiceProperties = config.getHashLoginServiceProperties();

  HashLoginService loginService = new HashLoginService(realm, loginServiceProperties);
  server.addBean(loginService);

  return configureCommonAuthentication(server, connector, config, Constraint.__BASIC_AUTH,
      allowedRoles, new BasicAuthenticator(), null, loginService);
}
 
开发者ID:apache,项目名称:calcite-avatica,代码行数:13,代码来源:HttpServer.java

示例4: configureDigestAuthentication

import org.eclipse.jetty.server.Server; //导入方法依赖的package包/类
protected ConstraintSecurityHandler configureDigestAuthentication(Server server,
    ServerConnector connector, AvaticaServerConfiguration config) {
  final String[] allowedRoles = config.getAllowedRoles();
  final String realm = config.getHashLoginServiceRealm();
  final String loginServiceProperties = config.getHashLoginServiceProperties();

  HashLoginService loginService = new HashLoginService(realm, loginServiceProperties);
  server.addBean(loginService);

  return configureCommonAuthentication(server, connector, config, Constraint.__DIGEST_AUTH,
      allowedRoles, new DigestAuthenticator(), null, loginService);
}
 
开发者ID:apache,项目名称:calcite-avatica,代码行数:13,代码来源:HttpServer.java


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