org.eclipse.jetty.jmx.MBeanContainer Java Examples
The following examples show how to use
org.eclipse.jetty.jmx.MBeanContainer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EmbeddedServerConfig.java From secrets-proxy with Apache License 2.0 | 6 votes |
/** * Configures the embedded jetty server. The values are configured in <b>application.yaml</b> * file. * * @param port jetty server port * @param maxThreads thread pool min thread * @param minThreads thread pool max thread * @param idleTimeout maximum thread idle time * @param jmxEnabled true, if jetty jmx is enabled. * @return {@link JettyEmbeddedServletContainerFactory} */ @Bean public JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory( @Value("${server.port:8443}") final int port, @Value("${jetty.thread-pool.max-threads:200}") final int maxThreads, @Value("${jetty.thread-pool.min-threads:8}") final int minThreads, @Value("${jetty.thread-pool.idle-timeout:60000}") final int idleTimeout, @Value("${jetty.jmx.enabled:true}") final boolean jmxEnabled) { log.info("Configuring Jetty server."); final JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory(port); factory.addServerCustomizers( server -> { final QueuedThreadPool threadPool = server.getBean(QueuedThreadPool.class); threadPool.setMinThreads(minThreads); threadPool.setMaxThreads(maxThreads); threadPool.setIdleTimeout(idleTimeout); log.info("Server thread pool config: " + server.getThreadPool()); // Jetty JMX config. if (jmxEnabled) { log.info("Exposing Jetty managed beans to the JMX platform server."); server.addBean(new MBeanContainer(ManagementFactory.getPlatformMBeanServer())); } }); return factory; }
Example #2
Source File: ApplicationServer.java From rest-utils with Apache License 2.0 | 6 votes |
public ApplicationServer(T config, ThreadPool threadPool) { super(threadPool); this.config = config; this.applications = new ApplicationGroup(this); int gracefulShutdownMs = config.getInt(RestConfig.SHUTDOWN_GRACEFUL_MS_CONFIG); if (gracefulShutdownMs > 0) { super.setStopTimeout(gracefulShutdownMs); } super.setStopAtShutdown(true); MBeanContainer mbContainer = new MBeanContainer(ManagementFactory.getPlatformMBeanServer()); super.addEventListener(mbContainer); super.addBean(mbContainer); this.sslContextFactory = createSslContextFactory(config); configureConnectors(sslContextFactory); }
Example #3
Source File: ServerApp.java From nordpos with GNU General Public License v3.0 | 6 votes |
@Override public void start() throws Exception { MBeanContainer mbContainer=new MBeanContainer(ManagementFactory.getPlatformMBeanServer()); server.addBean(mbContainer); org.eclipse.jetty.webapp.Configuration.ClassList classlist = org.eclipse.jetty.webapp.Configuration.ClassList.setServerDefault(server); classlist.addBefore("org.eclipse.jetty.webapp.JettyWebXmlConfiguration", "org.eclipse.jetty.annotations.AnnotationConfiguration"); if (server.isStopped()) { Thread t = new Thread(new Runnable() { @Override public void run() { try { server.start(); } catch (Exception ex) { // Logged by Jetty and managed by Lifecycle listener } } }); t.start(); } }
Example #4
Source File: JettyServer.java From conductor with Apache License 2.0 | 5 votes |
/** * Enabled JMX reporting: * https://docs.newrelic.com/docs/agents/java-agent/troubleshooting/application-server-jmx-setup * https://www.eclipse.org/jetty/documentation/current/jmx-chapter */ private void configureMBeanContainer(final Server server){ final MBeanContainer mbContainer = new MBeanContainer(getPlatformMBeanServer()); server.addEventListener(mbContainer); server.addBean(mbContainer); server.addBean(getLog()); }
Example #5
Source File: JettyHttpServer.java From vespa with Apache License 2.0 | 5 votes |
private static void setupJmx(Server server, ServerConfig serverConfig) { if (serverConfig.jmx().enabled()) { System.setProperty("java.rmi.server.hostname", "localhost"); server.addBean( new MBeanContainer(ManagementFactory.getPlatformMBeanServer())); server.addBean( new ConnectorServer( createJmxLoopbackOnlyServiceUrl(serverConfig.jmx().listenPort()), "org.eclipse.jetty.jmx:name=rmiconnectorserver")); } }
Example #6
Source File: JettyComposer.java From ja-micro with Apache License 2.0 | 5 votes |
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()); }
Example #7
Source File: Jetty9ServerTest.java From gocd with Apache License 2.0 | 5 votes |
@Test public void shouldAddMBeanContainerAsEventListener() throws Exception { ArgumentCaptor<MBeanContainer> captor = ArgumentCaptor.forClass(MBeanContainer.class); jetty9Server.configure(); verify(server).addEventListener(captor.capture()); MBeanContainer mBeanContainer = captor.getValue(); assertThat(mBeanContainer.getMBeanServer(), is(not(nullValue()))); }
Example #8
Source File: JettyServerWrapper.java From cougar with Apache License 2.0 | 4 votes |
public void initialiseConnectors() throws Exception { threadPool = new QueuedThreadPool(); threadPool.setMaxThreads(maxThreads); threadPool.setMinThreads(minThreads); threadPool.setName("JettyThread"); jettyServer = new Server(threadPool); jettyServer.setStopAtShutdown(true); MBeanContainer container = new MBeanContainer(mbeanServer); jettyServer.addBean(container); LowResourceMonitor lowResourcesMonitor = new LowResourceMonitor(jettyServer); lowResourcesMonitor.setPeriod(lowResourcesPeriod); lowResourcesMonitor.setLowResourcesIdleTimeout(lowResourcesIdleTime); lowResourcesMonitor.setMonitorThreads(lowResourcesMonitorThreads); lowResourcesMonitor.setMaxConnections(lowResourcesMaxConnections); lowResourcesMonitor.setMaxMemory(lowResourcesMaxMemory); lowResourcesMonitor.setMaxLowResourcesTime(lowResourcesMaxTime); jettyServer.addBean(lowResourcesMonitor); // US24803 - Needed for preventing Hashtable key collision DoS CVE-2012-2739 jettyServer.setAttribute("org.eclipse.jetty.server.Request.maxFormContentSize", maxFormContentSize); List<Connector> connectors = new ArrayList<Connector>(); if (httpPort != -1) { httpConfiguration = createHttpConfiguration(); setBufferSizes(httpConfiguration); if (httpForwarded) { httpConfiguration.addCustomizer(new ForwardedRequestCustomizer()); } httpConnector = createHttpConnector(jettyServer, httpConfiguration, httpAcceptors, httpSelectors); httpConnector.setPort(httpPort); httpConnector.setReuseAddress(httpReuseAddress); httpConnector.setIdleTimeout(httpMaxIdle); httpConnector.setAcceptQueueSize(httpAcceptQueueSize); httpConnector.addBean(new ConnectorStatistics()); connectors.add(httpConnector); } if (httpsPort != -1) { SslContextFactory sslContextFactory = new SslContextFactory(); sslContextFactory.setKeyStorePath(httpsKeystore.getFile().getCanonicalPath()); sslContextFactory.setKeyStoreType(httpsKeystoreType); sslContextFactory.setKeyStorePassword(httpsKeyPassword); if (StringUtils.isNotBlank(httpsCertAlias)) { sslContextFactory.setCertAlias(httpsCertAlias); } sslContextFactory.setKeyManagerPassword(httpsKeyPassword); // if you need it then you defo want it sslContextFactory.setWantClientAuth(httpsNeedClientAuth || httpsWantClientAuth); sslContextFactory.setNeedClientAuth(httpsNeedClientAuth); sslContextFactory.setRenegotiationAllowed(httpsAllowRenegotiate); httpsConfiguration = createHttpConfiguration(); setBufferSizes(httpsConfiguration); if (httpsForwarded) { httpsConfiguration.addCustomizer(new ForwardedRequestCustomizer()); } httpsConnector = createHttpsConnector(jettyServer, httpsConfiguration, httpsAcceptors, httpsSelectors, sslContextFactory); httpsConnector.setPort(httpsPort); httpsConnector.setReuseAddress(httpsReuseAddress); httpsConnector.setIdleTimeout(httpsMaxIdle); httpsConnector.setAcceptQueueSize(httpsAcceptQueueSize); httpsConnector.addBean(new ConnectorStatistics()); mbeanServer.registerMBean(getKeystoreCertificateChains(), new ObjectName("CoUGAR.https:name=keyStore")); // truststore is not required if we don't want client auth if (httpsWantClientAuth) { sslContextFactory.setTrustStorePath(httpsTruststore.getFile().getCanonicalPath()); sslContextFactory.setTrustStoreType(httpsTruststoreType); sslContextFactory.setTrustStorePassword(httpsTrustPassword); mbeanServer.registerMBean(getTruststoreCertificateChains(), new ObjectName("CoUGAR.https:name=trustStore")); } connectors.add(httpsConnector); } if (connectors.size() == 0) { throw new IllegalStateException("HTTP transport requires at least one port enabled to function correctly."); } jettyServer.setConnectors(connectors.toArray(new Connector[connectors.size()])); }
Example #9
Source File: ServerDaemon.java From cloudstack with Apache License 2.0 | 4 votes |
@Override public void start() throws Exception { // Thread pool final QueuedThreadPool threadPool = new QueuedThreadPool(); threadPool.setMinThreads(10); threadPool.setMaxThreads(500); // Jetty Server server = new Server(threadPool); // Setup Scheduler server.addBean(new ScheduledExecutorScheduler()); // Setup JMX final MBeanContainer mbeanContainer = new MBeanContainer(ManagementFactory.getPlatformMBeanServer()); server.addBean(mbeanContainer); // HTTP config final HttpConfiguration httpConfig = new HttpConfiguration(); httpConfig.addCustomizer( new ForwardedRequestCustomizer() ); httpConfig.setSecureScheme("https"); httpConfig.setSecurePort(httpsPort); httpConfig.setOutputBufferSize(32768); httpConfig.setRequestHeaderSize(8192); httpConfig.setResponseHeaderSize(8192); httpConfig.setSendServerVersion(false); httpConfig.setSendDateHeader(false); // HTTP Connector createHttpConnector(httpConfig); // Setup handlers Pair<SessionHandler,HandlerCollection> pair = createHandlers(); server.setHandler(pair.second()); // Extra config options server.setStopAtShutdown(true); // HTTPS Connector createHttpsConnector(httpConfig); server.start(); // Must set the session timeout after the server has started pair.first().setMaxInactiveInterval(sessionTimeout * 60); server.join(); }
Example #10
Source File: Jetty9Server.java From gocd with Apache License 2.0 | 4 votes |
private MBeanContainer mbeans() { MBeanServer platformMBeanServer = ManagementFactory.getPlatformMBeanServer(); return new MBeanContainer(platformMBeanServer); }
Example #11
Source File: JettyServer.java From artifactory_ssh_proxy with Apache License 2.0 | 4 votes |
@SuppressWarnings({"resource", "boxing"}) public static Server newServer(int jettyPort, String jettyWebAppDir, JettyServiceSetting jettyServiceSetting) throws Exception { if (jettyPort == 0 || jettyWebAppDir == null) { throw new IllegalArgumentException("Jetty port and resource dir may not be empty"); } // server setup Server server = new Server(); server.addBean(new ScheduledExecutorScheduler()); server.setDumpAfterStart(false); server.setDumpBeforeStop(false); server.setStopAtShutdown(true); // http://www.eclipse.org/jetty/documentation/current/embedding-jetty.html#d0e19050 // Setup JMX MBeanContainer mbContainer = new MBeanContainer(ManagementFactory.getPlatformMBeanServer()); server.addBean(mbContainer); //setup handlers according to the jetty settings HandlerCollection handlerCollection = new HandlerCollection(); if (jettyServiceSetting == JettyServiceSetting.ARTIFACTORY || jettyServiceSetting == JettyServiceSetting.BOTH) { // The WebAppContext is the entity that controls the environment in // which a web application lives and breathes. In this example the // context path is being set to "/" so it is suitable for serving root // context requests and then we see it setting the location of the war. // A whole host of other configurations are available, ranging from // configuring to support annotation scanning in the webapp (through // PlusConfiguration) to choosing where the webapp will unpack itself. WebAppContext webapp = new WebAppContext(); File warFile = new File(jettyWebAppDir + File.separator + "artifactory.war"); webapp.setContextPath("/artifactory"); webapp.setWar(warFile.getAbsolutePath()); // A WebAppContext is a ContextHandler as well so it needs to be set to // the server so it is aware of where to send the appropriate requests. handlerCollection.addHandler(webapp); } if (jettyServiceSetting == JettyServiceSetting.VIP || jettyServiceSetting == JettyServiceSetting.BOTH) { // Serve resource files which reside in the jettyWebAppDir ResourceHandler resourceHandler = new ResourceHandler(); resourceHandler.setDirectoriesListed(false); resourceHandler.setResourceBase(jettyWebAppDir); handlerCollection.addHandler(resourceHandler); } server.setHandler(handlerCollection); // http configuration HttpConfiguration http_config = new HttpConfiguration(); http_config.setSendServerVersion(true); // HTTP connector ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(http_config)); http.setPort(jettyPort); server.addConnector(http); // start server server.start(); LOG.info("Started jetty server on port: {}, resource dir: {} ", jettyPort, jettyWebAppDir); return server; }
Example #12
Source File: JMXManager.java From Openfire with Apache License 2.0 | 4 votes |
public void setContainer(MBeanContainer mbContainer) { this.mbContainer = mbContainer; }
Example #13
Source File: JMXManager.java From Openfire with Apache License 2.0 | 4 votes |
public MBeanContainer getContainer() { return mbContainer; }
Example #14
Source File: JMXManager.java From Openfire with Apache License 2.0 | 4 votes |
private void start() { setContainer(new MBeanContainer(ManagementFactory.getPlatformMBeanServer())); int jmxPort = JMXManager.getPort(); String jmxUrl = "/jndi/rmi://localhost:" + jmxPort + "/jmxrmi"; Map<String, Object> env = new HashMap<>(); if (JMXManager.isSecure()) { env.put("jmx.remote.authenticator", new JMXAuthenticator() { @Override public Subject authenticate(Object credentials) { if (!(credentials instanceof String[])) { if (credentials == null) { throw new SecurityException("Credentials required"); } throw new SecurityException("Credentials should be String[]"); } final String[] aCredentials = (String[]) credentials; if (aCredentials.length < 2) { throw new SecurityException("Credentials should have at least two elements"); } String username = aCredentials[0]; String password = aCredentials[1]; try { AuthFactory.authenticate(username, password); } catch (Exception ex) { Log.error("Authentication failed for " + username); throw new SecurityException(); } if (AdminManager.getInstance().isUserAdmin(username, true)) { return new Subject(true, Collections.singleton(new JMXPrincipal(username)), Collections.EMPTY_SET, Collections.EMPTY_SET); } else { Log.error("Authorization failed for " + username); throw new SecurityException(); } } }); } try { jmxServer = new ConnectorServer(new JMXServiceURL("rmi", null, jmxPort, jmxUrl), env, "org.eclipse.jetty.jmx:name=rmiconnectorserver"); jmxServer.start(); } catch (Exception e) { Log.error("Failed to start JMX connector", e); } }
Example #15
Source File: Start.java From wicket-orientdb with Apache License 2.0 | 4 votes |
/** * Main function, starts the jetty server. * * @param args */ public static void main(String[] args) { System.setProperty("wicket.configuration", "development"); Server server = new Server(); HttpConfiguration http_config = new HttpConfiguration(); http_config.setSecureScheme("https"); http_config.setSecurePort(8443); http_config.setOutputBufferSize(32768); ServerConnector http = new ServerConnector(server, new HttpConnectionFactory(http_config)); http.setPort(8080); http.setIdleTimeout(1000 * 60 * 60); server.addConnector(http); Resource keystore = Resource.newClassPathResource("/keystore"); if (keystore != null && keystore.exists()) { // if a keystore for a SSL certificate is available, start a SSL // connector on port 8443. // By default, the quickstart comes with a Apache Wicket Quickstart // Certificate that expires about half way september 2021. Do not // use this certificate anywhere important as the passwords are // available in the source. SslContextFactory sslContextFactory = new SslContextFactory(); sslContextFactory.setKeyStoreResource(keystore); sslContextFactory.setKeyStorePassword("wicket"); sslContextFactory.setKeyManagerPassword("wicket"); HttpConfiguration https_config = new HttpConfiguration(http_config); https_config.addCustomizer(new SecureRequestCustomizer()); ServerConnector https = new ServerConnector(server, new SslConnectionFactory( sslContextFactory, "http/1.1"), new HttpConnectionFactory(https_config)); https.setPort(8443); https.setIdleTimeout(500000); server.addConnector(https); System.out.println("SSL access to the examples has been enabled on port 8443"); System.out .println("You can access the application using SSL on https://localhost:8443"); System.out.println(); } WebAppContext bb = new WebAppContext(); bb.setServer(server); bb.setContextPath("/"); bb.setWar("src/main/webapp"); // uncomment next line if you want to test with JSESSIONID encoded in the urls // ((AbstractSessionManager) // bb.getSessionHandler().getSessionManager()).setUsingCookies(false); server.setHandler(bb); MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); MBeanContainer mBeanContainer = new MBeanContainer(mBeanServer); server.addEventListener(mBeanContainer); server.addBean(mBeanContainer); try { server.start(); server.join(); } catch (Exception e) { e.printStackTrace(); System.exit(100); } }
Example #16
Source File: AbstractJettyMixin.java From attic-polygene-java with Apache License 2.0 | 4 votes |
@Override public final void startJetty() throws Exception { // Configure Server configureServer( server, configuration() ); // Set up HTTP HttpConfiguration httpConfig = new HttpConfiguration(); configureHttp( httpConfig, configuration() ); httpConfig = specializeHttp( httpConfig ); // Set up connector ServerConnector connector = buildConnector( server, httpConfig ); configureConnector( connector, configuration() ); // Bind Connector to Server server.addConnector( connector ); if( mBeanServer != null ) { server.addEventListener( new MBeanContainer( mBeanServer ) ); } // Prepare ServletContext ServletContextHandler root = new ServletContextHandler( server, "/", new SessionHandler(), buildSecurityHandler(), new ServletHandler(), new ErrorHandler() ); root.setDisplayName( identity.toString() ); configureContext( root, configuration() ); // Register ContextListeners, Servlets and Filters addContextListeners( root, contextListeners ); addServlets( root, servlets ); addFilters( root, filters ); // Start server.start(); }
Example #17
Source File: CitizenIntelligenceAgencyServer.java From cia with Apache License 2.0 | 4 votes |
/** * Inits the. * * @throws Exception the exception */ public final void init() throws Exception { initialised = true; server = new Server(); Security.addProvider(new BouncyCastleProvider()); // Setup JMX final MBeanContainer mbContainer = new MBeanContainer(ManagementFactory.getPlatformMBeanServer()); server.addBean(mbContainer); final org.eclipse.jetty.webapp.Configurations classlist = org.eclipse.jetty.webapp.Configurations.setServerDefault(server); final HttpConfiguration http_config = new HttpConfiguration(); http_config.setSecureScheme("https"); http_config.setSecurePort(28443); http_config.setSendServerVersion(false); final HttpConfiguration https_config = new HttpConfiguration(http_config); https_config.addCustomizer(new SecureRequestCustomizer()); final SslContextFactory.Server sslContextFactory = new SslContextFactory.Server(); sslContextFactory.setKeyStoreType("PKCS12"); sslContextFactory.setKeyStorePath("target/keystore.p12"); sslContextFactory.setTrustStorePath("target/keystore.p12"); sslContextFactory.setTrustStoreType("PKCS12"); sslContextFactory.setKeyStorePassword("changeit"); sslContextFactory.setTrustStorePassword("changeit"); sslContextFactory.setKeyManagerPassword("changeit"); sslContextFactory.setCertAlias("jetty"); sslContextFactory.setIncludeCipherSuites("TLS_AES_256_GCM_SHA384", "TLS_CHACHA20_POLY1305_SHA256", "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256", "TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256"); sslContextFactory.setExcludeProtocols("SSL", "SSLv2", "SSLv2Hello", "SSLv3", "TLSv1", "TLSv1.1"); sslContextFactory.setIncludeProtocols("TLSv1.2", "TLSv1.3"); final ServerConnector sslConnector = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, "http/1.1"), new HttpConnectionFactory(https_config), new HTTP2CServerConnectionFactory(https_config)); sslConnector.setPort(PORT); server.setConnectors(new ServerConnector[] { sslConnector }); final WebAppContext handler = new WebAppContext("src/main/webapp", "/"); handler.setExtraClasspath("target/classes"); handler.setParentLoaderPriority(true); handler.setConfigurationDiscovered(true); handler.setClassLoader(Thread.currentThread().getContextClassLoader()); final HandlerList handlers = new HandlerList(); handlers.setHandlers(new Handler[] { handler, new DefaultHandler() }); server.setHandler(handlers); }
Example #18
Source File: JettyServerFactory.java From gravitee-management-rest-api with Apache License 2.0 | 4 votes |
@Override public Server getObject() throws Exception { // Setup ThreadPool QueuedThreadPool threadPool = new QueuedThreadPool( jettyConfiguration.getPoolMaxThreads(), jettyConfiguration.getPoolMinThreads(), jettyConfiguration.getPoolIdleTimeout(), new ArrayBlockingQueue<Runnable>(jettyConfiguration.getPoolQueueSize()) ); threadPool.setName("gravitee-listener"); Server server = new Server(threadPool); // Extra options server.setDumpAfterStart(false); server.setDumpBeforeStop(false); server.setStopAtShutdown(true); // Setup JMX if (jettyConfiguration.isJmxEnabled()) { MBeanContainer mbContainer = new MBeanContainer( ManagementFactory.getPlatformMBeanServer()); server.addBean(mbContainer); } // HTTP Configuration HttpConfiguration httpConfig = new HttpConfiguration(); httpConfig.setOutputBufferSize(32768); httpConfig.setRequestHeaderSize(8192); httpConfig.setResponseHeaderSize(8192); httpConfig.setSendServerVersion(false); httpConfig.setSendDateHeader(false); // Setup Jetty HTTP or HTTPS Connector if (jettyConfiguration.isSecured()) { httpConfig.setSecureScheme("https"); httpConfig.setSecurePort(jettyConfiguration.getHttpPort()); // SSL Context Factory SslContextFactory sslContextFactory = new SslContextFactory.Server(); if (jettyConfiguration.getKeyStorePath() != null) { sslContextFactory.setKeyStorePath(jettyConfiguration.getKeyStorePath()); sslContextFactory.setKeyStorePassword(jettyConfiguration.getKeyStorePassword()); if (KEYSTORE_TYPE_PKCS12.equalsIgnoreCase(jettyConfiguration.getKeyStoreType())) { sslContextFactory.setKeyStoreType(KEYSTORE_TYPE_PKCS12); } } if (jettyConfiguration.getTrustStorePath() != null) { sslContextFactory.setTrustStorePath(jettyConfiguration.getTrustStorePath()); sslContextFactory.setTrustStorePassword(jettyConfiguration.getTrustStorePassword()); if (KEYSTORE_TYPE_PKCS12.equalsIgnoreCase(jettyConfiguration.getTrustStoreType())) { sslContextFactory.setTrustStoreType(KEYSTORE_TYPE_PKCS12); } } HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig); httpsConfig.addCustomizer(new SecureRequestCustomizer()); ServerConnector https = new ServerConnector(server, new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()), new HttpConnectionFactory(httpsConfig)); https.setHost(jettyConfiguration.getHttpHost()); https.setPort(jettyConfiguration.getHttpPort()); server.addConnector(https); } else { ServerConnector http = new ServerConnector(server, jettyConfiguration.getAcceptors(), jettyConfiguration.getSelectors(), new HttpConnectionFactory(httpConfig)); http.setHost(jettyConfiguration.getHttpHost()); http.setPort(jettyConfiguration.getHttpPort()); http.setIdleTimeout(jettyConfiguration.getIdleTimeout()); server.addConnector(http); } // Setup Jetty statistics if (jettyConfiguration.isStatisticsEnabled()) { StatisticsHandler stats = new StatisticsHandler(); stats.setHandler(server.getHandler()); server.setHandler(stats); } if (jettyConfiguration.isAccessLogEnabled()) { CustomRequestLog requestLog = new CustomRequestLog( new AsyncRequestLogWriter(jettyConfiguration.getAccessLogPath()), CustomRequestLog.EXTENDED_NCSA_FORMAT); server.setRequestLog(requestLog); } return server; }