當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。