Java Code Examples for org.eclipse.jetty.servlet.ServletContextHandler#SESSIONS

The following examples show how to use org.eclipse.jetty.servlet.ServletContextHandler#SESSIONS . 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: OrderService.java    From qcon-microservices with Apache License 2.0 6 votes vote down vote up
Server startJetty(int port, Object binding) {
    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setContextPath("/");

    Server jettyServer = new Server(port);
    jettyServer.setHandler(context);

    ResourceConfig rc = new ResourceConfig();
    rc.register(binding);
    rc.register(JacksonFeature.class);

    ServletContainer sc = new ServletContainer(rc);
    ServletHolder holder = new ServletHolder(sc);
    context.addServlet(holder, "/*");

    try {
        jettyServer.start();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    log.info("Listening on " + jettyServer.getURI());
    return jettyServer;
}
 
Example 2
Source File: Main.java    From homework_tester with MIT License 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    Server server = new Server(8080);
    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);

    context.addServlet(new ServletHolder(new WebSocketChatServlet()), "/chat");

    ResourceHandler resource_handler = new ResourceHandler();
    resource_handler.setDirectoriesListed(true);
    resource_handler.setResourceBase("public_html");

    HandlerList handlers = new HandlerList();
    handlers.setHandlers(new Handler[]{resource_handler, context});
    server.setHandler(handlers);

    server.start();
    System.out.println("Server started!");
    server.join();
}
 
Example 3
Source File: PcapService.java    From opensoc-streaming with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws IOException {

		PcapServiceCli cli = new PcapServiceCli(args);
		cli.parse();
		
		Server server = new Server(cli.getPort());
		ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
		context.setContextPath("/");
		ServletHolder h = new ServletHolder(new HttpServletDispatcher());
		h.setInitParameter("javax.ws.rs.Application", "com.opensoc.pcapservice.rest.JettyServiceRunner");
		context.addServlet(h, "/*");
		server.setHandler(context);
		try {
			server.start();
			server.join();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
 
Example 4
Source File: ClientProxy.java    From OmniOcular with Apache License 2.0 5 votes vote down vote up
@Override
public void startHttpServer() {
    Thread t = new Thread(new Runnable() {
        @Override
        public void run() {
            Server server = new Server(23333);
            try {
                ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
                context.setContextPath("/");
                ServletHolder wsHolder = new ServletHolder("echo", new WebSocketServlet() {
                    @Override
                    public void configure(WebSocketServletFactory factory) {
                        factory.register(WebSocketHandler.class);
                    }
                });
                context.addServlet(wsHolder, "/w");

                URI uri = OmniOcular.class.getResource("/assets/omniocular/static/").toURI();
                context.setBaseResource(Resource.newResource(uri));
                context.setWelcomeFiles(new String[]{"index.html"});
                ServletHolder holderPwd = new ServletHolder("default", DefaultServlet.class);
                holderPwd.setInitParameter("cacheControl", "max-age=0,public");
                holderPwd.setInitParameter("useFileMappedBuffer", "false");
                context.addServlet(holderPwd, "/");

                server.setHandler(context);
                server.start();
                server.join();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
    t.start();

}
 
Example 5
Source File: ProxyServer.java    From pulsar with Apache License 2.0 5 votes vote down vote up
public void addRestResources(String basePath, String javaPackages, String attribute, Object attributeValue) {
    ResourceConfig config = new ResourceConfig();
    config.packages("jersey.config.server.provider.packages", javaPackages);
    config.register(JsonMapperProvider.class);
    ServletHolder servletHolder = new ServletHolder(new ServletContainer(config));
    servletHolder.setAsyncSupported(true);
    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setContextPath(basePath);
    context.addServlet(servletHolder, "/*");
    context.setAttribute(attribute, attributeValue);
    handlers.add(context);
}
 
Example 6
Source File: SimonConsoleJettyDemo.java    From javasimon with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void initServer() {
	// Server
	server = new Server(8080);
	// Context
	ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
	context.setContextPath("/");
	server.setHandler(context);
	// Callbacks
	CompositeCallback compositeCallback = new CompositeCallbackImpl();
	// QuantilesCallback automatically configured after 5 splits (5 buckets)
	compositeCallback.addCallback(new AutoQuantilesCallback(5, 5));
	// QuantilesCallback manually configured 5 duration buckets 200ms wide each
	// compositeCallback.addCallback(new FixedQuantilesCallback(0L, 200L, 5));
	// TimelineCallback 10 time range buckets of 1 minute each
	compositeCallback.addCallback(new TimelineCallback(10, 60000L));
	SimonManager.callback().addCallback(new AsyncCallbackProxyFactory(compositeCallback).newProxy());
	// CallTreeCallback doesn't support asynchronous operation
	SimonManager.callback().addCallback(new CallTreeCallback(50));
	// Simon Servlet
	final SimonConsoleServlet simonConsoleServlet = new SimonConsoleServlet();
	ServletHolder servletHolder = new ServletHolder(simonConsoleServlet);
	servletHolder.setInitParameter("console-path", "");
	servletHolder.setInitParameter("plugin-classes",
		QuantilesDetailPlugin.class.getName()
			+ "," + CallTreeDetailPlugin.class.getName()
			+ "," + TimelineDetailPlugin.class.getName());
	context.addServlet(servletHolder, "/*");
}
 
Example 7
Source File: MockServer.java    From aws-sdk-java-v2 with Apache License 2.0 5 votes vote down vote up
public MockServer() throws IOException {
    server = new Server();
    connector = new ServerConnector(server);
    connector.setPort(httpPort);

    HttpConfiguration https = new HttpConfiguration();
    https.addCustomizer(new SecureRequestCustomizer());

    SslContextFactory sslContextFactory = new SslContextFactory();
    sslContextFactory.setTrustAll(true);
    sslContextFactory.setValidateCerts(false);
    sslContextFactory.setNeedClientAuth(false);
    sslContextFactory.setWantClientAuth(false);
    sslContextFactory.setValidatePeerCerts(false);
    sslContextFactory.setKeyStorePassword("password");
    sslContextFactory.setKeyStorePath(MockServer.class.getResource("mock-keystore.jks").toExternalForm());

    sslConnector = new ServerConnector(server,
                                       new SslConnectionFactory(sslContextFactory,
                                                                HttpVersion.HTTP_1_1.asString()),
                                       new HttpConnectionFactory(https));
    sslConnector.setPort(httpsPort);

    server.setConnectors(new Connector[] {connector, sslConnector});

    ServletContextHandler context = new ServletContextHandler(server, "/", ServletContextHandler.SESSIONS);
    context.addServlet(new ServletHolder(new AlwaysSuccessServlet()), "/*");
    server.setHandler(context);
}
 
Example 8
Source File: WebSocketServerInputOperator.java    From attic-apex-malhar with Apache License 2.0 5 votes vote down vote up
@Override
public void setup(OperatorContext context)
{
  server = new Server(port);
  DefaultWebSocketServlet servlet = new DefaultWebSocketServlet();
  ServletHolder sh = new ServletHolder(servlet);
  ServletContextHandler contextHandler = new ServletContextHandler(server, "/", ServletContextHandler.SESSIONS);
  contextHandler.addServlet(sh, extension);

  try {
    server.start();
  } catch (Exception ex) {
    DTThrowable.rethrow(ex);
  }
}
 
Example 9
Source File: Main.java    From homework_tester with MIT License 5 votes vote down vote up
public static void main(String[] args) throws Exception {

        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
        context.addServlet(new ServletHolder(new MirrorServlet()), "/mirror");

        Server server = new Server(8080);
        server.setHandler(context);

        server.start();
        System.out.println("Server started!");
        server.join();
    }
 
Example 10
Source File: MockServer.java    From knox with Apache License 2.0 5 votes vote down vote up
private ServletContextHandler createHandler() {
  Servlet servlet = new MockServlet( getName(), interactions );
  ServletHolder holder = new ServletHolder( servlet );
  ServletContextHandler context = new ServletContextHandler( ServletContextHandler.SESSIONS );
  context.setContextPath( "/" );
  context.addServlet( holder, "/*" );
  return context;
}
 
Example 11
Source File: MockEchoWebsocketServer.java    From zeppelin with Apache License 2.0 5 votes vote down vote up
public MockEchoWebsocketServer(int port) {
  server = new Server();
  ServerConnector connector = new ServerConnector(server);
  connector.setPort(port);
  server.addConnector(connector);

  ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
  context.setContextPath("/");
  server.setHandler(context);

  //ServletHolder holderEvents = new ServletHolder("ws-events", MockEventServlet.class);
  context.addServlet(MockEventServlet.class, "/ws/*");
}
 
Example 12
Source File: WebSocketServer.java    From product-cep with Apache License 2.0 5 votes vote down vote up
public void start(int port) {
    server = new Server();
    ServerConnector connector = new ServerConnector(server);
    connector.setPort(port);
    server.addConnector(connector);

    // Setup the basic application "context" for this application at "/"
    // This is also known as the handler tree (in jetty speak)
    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setContextPath("/");
    server.setHandler(context);

    try {
        // Initialize javax.websocket layer
        ServerContainer wscontainer = WebSocketServerContainerInitializer.configureContext(context);

        // Add WebSocket endpoint to javax.websocket layer
        wscontainer.addEndpoint(EventSocket.class);

        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    server.start();
                    server.join();
                } catch (Exception e) {
                    log.error(e);
                }
            }
        }).start();

    } catch (Throwable t) {
        log.error(t);
    }
}
 
Example 13
Source File: WebServer.java    From pulsar with Apache License 2.0 5 votes vote down vote up
public void addRestResources(String basePath, String javaPackages, String attribute, Object attributeValue) {
    ResourceConfig config = new ResourceConfig();
    config.packages("jersey.config.server.provider.packages", javaPackages);
    config.register(JsonMapperProvider.class);
    ServletHolder servletHolder = new ServletHolder(new ServletContainer(config));
    servletHolder.setAsyncSupported(true);
    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setContextPath(basePath);
    context.addServlet(servletHolder, "/*");
    context.setAttribute(attribute, attributeValue);
    handlers.add(context);
}
 
Example 14
Source File: NoSpringServletServer.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Override
protected void run() {
    // setup the system properties
    String busFactory = System.getProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME);
    System.setProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME, "org.apache.cxf.bus.CXFBusFactory");
    try {
        httpServer = new Server(Integer.parseInt(PORT));
        ContextHandlerCollection contexts = new ContextHandlerCollection();
        httpServer.setHandler(contexts);

        ServletContextHandler root = new ServletContextHandler(contexts, "/",
                                                               ServletContextHandler.SESSIONS);
        bus = BusFactory.getDefaultBus(true);
        CXFServlet cxf = new CXFServlet();
        cxf.setBus(bus);
        ServletHolder servlet = new ServletHolder(cxf);
        servlet.setName("soap");
        servlet.setForcedPath("soap");
        root.addServlet(servlet, "/soap/*");

        httpServer.start();
        setBus(bus);
        BusFactory.setDefaultBus(bus);
        GreeterImpl impl = new GreeterImpl();
        Endpoint.publish("/Greeter", impl);
        HelloImpl helloImpl = new HelloImpl();
        Endpoint.publish("/Hello", helloImpl);

        ((EndpointImpl)Endpoint.create(helloImpl)).publish("/");

    } catch (Exception e) {
        throw new RuntimeException(e);
    } finally {
        // clean up the system properties
        if (busFactory != null) {
            System.setProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME, busFactory);
        } else {
            System.clearProperty(BusFactory.BUS_FACTORY_PROPERTY_NAME);
        }
    }
}
 
Example 15
Source File: CacheServiceTest.java    From Kylin with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void beforeClass() throws Exception {
    createTestMetadata(LOCALMETA_TEST_DATA);
    configA = KylinConfig.getInstanceFromEnv();
    configB = KylinConfig.getKylinConfigFromInputStream(KylinConfig.getKylinPropertiesAsInputSteam());
    configB.setMetadataUrl("../examples/test_metadata");

    server = new Server(7070);
    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setContextPath("/");
    server.setHandler(context);

    context.addServlet(new ServletHolder(new BroadcasterReceiveServlet(new BroadcasterReceiveServlet.BroadcasterHandler() {
        @Override
        public void handle(String type, String name, String event) {
            final CacheService cacheService = new CacheService() {
                @Override
                public KylinConfig getConfig() {
                    return configB;
                }
            };
            Broadcaster.TYPE wipeType = Broadcaster.TYPE.getType(type);
            Broadcaster.EVENT wipeEvent = Broadcaster.EVENT.getEvent(event);
            final String log = "wipe cache type: " + wipeType + " event:" + wipeEvent + " name:" + name;
            logger.info(log);
            counter.incrementAndGet();
            switch (wipeEvent) {
                case CREATE:
                case UPDATE:
                    cacheService.rebuildCache(wipeType, name);
                    break;
                case DROP:
                    cacheService.removeCache(wipeType, name);
                    break;
                default:
                    throw new RuntimeException("invalid type:" + wipeEvent);
            }
        }
    })), "/");
    server.start();
}
 
Example 16
Source File: RestfulServer.java    From shardingsphere-elasticjob-cloud with Apache License 2.0 4 votes vote down vote up
private ServletContextHandler buildServletContextHandler() {
    ServletContextHandler result = new ServletContextHandler(ServletContextHandler.SESSIONS);
    result.setContextPath("/");
    return result;
}
 
Example 17
Source File: ManagerApiTestServer.java    From apiman with Apache License 2.0 4 votes vote down vote up
/**
     * Configure the web application(s).
     * @param handlers
     * @throws Exception
     */
    protected void addModulesToJetty(ContextHandlerCollection handlers) throws Exception {
        /* *************
         * Manager API
         * ************* */
        ServletContextHandler apiManServer = new ServletContextHandler(ServletContextHandler.SESSIONS);
        apiManServer.setSecurityHandler(createSecurityHandler());
        apiManServer.setContextPath("/apiman");
        apiManServer.addEventListener(new Listener());
        apiManServer.addEventListener(new BeanManagerResourceBindingListener());
        apiManServer.addEventListener(new ResteasyBootstrap());
        apiManServer.addFilter(DatabaseSeedFilter.class, "/db-seeder", EnumSet.of(DispatcherType.REQUEST));
//        apiManServer.addFilter(LocaleFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
        apiManServer.addFilter(ApimanCorsFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
        apiManServer.addFilter(DisableCachingFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
        configureAuthentication(apiManServer);
        apiManServer.addFilter(DefaultSecurityContextFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
        apiManServer.addFilter(TransactionWatchdogFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
        apiManServer.addFilter(RootResourceFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
        ServletHolder resteasyServlet = new ServletHolder(new HttpServletDispatcher());
        resteasyServlet.setInitParameter("javax.ws.rs.Application", TestManagerApiApplication.class.getName());
        apiManServer.addServlet(resteasyServlet, "/*");

        apiManServer.setInitParameter("resteasy.injector.factory", "org.jboss.resteasy.cdi.CdiInjectorFactory");
        apiManServer.setInitParameter("resteasy.scan", "true");
        apiManServer.setInitParameter("resteasy.servlet.mapping.prefix", "");

        // Add the web contexts to jetty
        handlers.addHandler(apiManServer);

        /* *************
         * Mock Gateway (to test publishing of APIs from dt to rt)
         * ************* */
        ServletContextHandler mockGatewayServer = new ServletContextHandler(ServletContextHandler.SESSIONS);
        mockGatewayServer.setSecurityHandler(createSecurityHandler());
        mockGatewayServer.setContextPath("/mock-gateway");
        ServletHolder mockGatewayServlet = new ServletHolder(new MockGatewayServlet());
        mockGatewayServer.addServlet(mockGatewayServlet, "/*");

        // Add the web contexts to jetty
        handlers.addHandler(mockGatewayServer);
    }
 
Example 18
Source File: PhrasalService.java    From phrasal with GNU General Public License v3.0 4 votes vote down vote up
/**
   * Start the service.
   * 
   * @param args
   */
  public static void main(String[] args) {
    Properties options = StringUtils.argsToProperties(args, optionArgDefs());
    int port = PropertiesUtils.getInt(options, "p", DEFAULT_HTTP_PORT);
    boolean loadMockServlet = PropertiesUtils.getBool(options, "m", false);
    boolean localHost = PropertiesUtils.getBool(options, "l", false);
    String uiFile = options.getProperty("u", "debug.html");
    String resourcePath = options.getProperty("r", ".");

    // Parse arguments
    String argList = options.getProperty("",null);
    String[] parsedArgs = argList == null ? null : argList.split("\\s+");
    if (parsedArgs == null || parsedArgs.length != 1) {
      System.out.println(usage());
      System.exit(-1);
    }
    String phrasalIniFile = parsedArgs[0];
    
    // Setup the jetty server
    Server server = new Server();

    // Jetty 8 way of configuring the server
//    Connector connector = new SelectChannelConnector();
//    connector.setPort(port);
//    server.addConnector(connector);

//  Jetty9 way of configuring the server
    ServerConnector connector = new ServerConnector(server);
    connector.setPort(port);
    server.addConnector(connector);

    if (localHost) {
      connector.setHost(DEBUG_URL);
    }
    
    // Setup the servlet context
    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setContextPath("/");
 
    // Add Phrasal servlet
    PhrasalServlet servlet = loadMockServlet ? new PhrasalServlet() : new PhrasalServlet(phrasalIniFile);
    context.addServlet(new ServletHolder(servlet), SERVLET_ROOT);

    // TODO(spenceg): gzip compression causes an encoding problem for unicode characters
    // on the client. Not sure if the compression or decompression is the problem.
//    EnumSet<DispatcherType> dispatches = EnumSet.of(DispatcherType.REQUEST, DispatcherType.ASYNC);
//    context.addFilter(new FilterHolder(new IncludableGzipFilter()), "/t", dispatches);

    // Add debugging web-page
    ResourceHandler resourceHandler = new ResourceHandler();
    resourceHandler.setWelcomeFiles(new String[]{ uiFile });
    resourceHandler.setResourceBase(resourcePath);

    HandlerList handlers = new HandlerList();
    handlers.setHandlers(new Handler[] { resourceHandler, context });
    server.setHandler(handlers);
    
    // Start the service
    try {
      logger.info("Starting PhrasalService on port: " + String.valueOf(port));
      server.start();
      server.join();
    } catch (Exception e) {
      logger.error("Servlet crashed. Service shutting down.");
      e.printStackTrace();
    }
  }
 
Example 19
Source File: MultiNodeManagerTestBase.java    From kylin-on-parquet-v2 with Apache License 2.0 4 votes vote down vote up
@Before
public void setup() throws Exception {
    staticCreateTestMetadata();
    System.clearProperty("kylin.server.cluster-servers");
    int port = CheckUtil.randomAvailablePort(40000, 50000);
    logger.info("Chosen port for CacheServiceTest is " + port);
    configA = KylinConfig.getInstanceFromEnv();
    configA.setProperty("kylin.server.cluster-servers", "localhost:" + port);
    configB = KylinConfig.createKylinConfig(configA);
    configB.setProperty("kylin.server.cluster-servers", "localhost:" + port);
    configB.setMetadataUrl("../examples/test_metadata");

    server = new Server(port);
    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setContextPath("/");
    server.setHandler(context);

    final CacheService serviceA = new CacheService() {
        @Override
        public KylinConfig getConfig() {
            return configA;
        }
    };
    final CacheService serviceB = new CacheService() {
        @Override
        public KylinConfig getConfig() {
            return configB;
        }
    };

    context.addServlet(new ServletHolder(new BroadcasterReceiveServlet(new BroadcasterReceiveServlet.BroadcasterHandler() {
        @Override
        public void handle(String entity, String cacheKey, String event) {
            Broadcaster.Event wipeEvent = Broadcaster.Event.getEvent(event);
            final String log = "wipe cache type: " + entity + " event:" + wipeEvent + " name:" + cacheKey;
            logger.info(log);
            try {
                serviceA.notifyMetadataChange(entity, wipeEvent, cacheKey);
                serviceB.notifyMetadataChange(entity, wipeEvent, cacheKey);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    })), "/");
    server.start();
}
 
Example 20
Source File: ODataTestServer.java    From syndesis with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings( "deprecation" )
private void initServer(SSLContext sslContext, String userName) throws UnknownHostException {
    ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
    context.setContextPath(FORWARD_SLASH);
    this.setHandler(context);

    ServletHandler productsHandler = new ServletHandler();
    productsHandler.addServletWithMapping(
        ProductsServlet.class,
        FORWARD_SLASH + PRODUCTS_SVC + FORWARD_SLASH + STAR);
    productsHandler.addFilterWithMapping(ODataPathFilter.class, FORWARD_SLASH + STAR, FilterMapping.REQUEST);
    context.insertHandler(productsHandler);

    if (userName != null) {
        LoginService loginService = new HashLoginService("MyRealm", "src/test/resources/realm.properties");
        this.addBean(loginService);

        ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler();
        Constraint constraint = new Constraint();
        constraint.setName("auth");
        constraint.setAuthenticate(true);
        constraint.setRoles(new String[] { USER, "admin" });

        ConstraintMapping mapping = new ConstraintMapping();
        mapping.setPathSpec(FORWARD_SLASH + PRODUCTS_SVC + FORWARD_SLASH + STAR);
        mapping.setConstraint(constraint);

        securityHandler.setConstraintMappings(Collections.singletonList(mapping));
        securityHandler.setAuthenticator(new BasicAuthenticator());

        context.setSecurityHandler(securityHandler);
    }

    httpConnector = new ServerConnector(this);
    httpConnector.setPort(httpPort); // Finds next available port if still 0
    this.addConnector(httpConnector);


    if (sslContext != null) {
        // HTTPS
        HttpConfiguration httpConfiguration = new HttpConfiguration();
        httpConfiguration.setSecureScheme("https");
        httpConfiguration.setSecurePort(httpsPort); // Finds next available port if still 0
        httpConfiguration.addCustomizer(new SecureRequestCustomizer());

        final SslContextFactory sslContextFactory = new SslContextFactory();
        sslContextFactory.setSslContext(sslContext);
        httpsConnector = new ServerConnector(this, sslContextFactory, new HttpConnectionFactory(httpConfiguration));
        httpsConnector.setPort(httpsPort); // Finds next available port if still 0
        this.addConnector(httpsConnector);
    }
}