io.undertow.server.handlers.resource.ClassPathResourceManager Java Examples

The following examples show how to use io.undertow.server.handlers.resource.ClassPathResourceManager. 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 Project: SikuliX1   Author: RaiMan   File: SikulixServer.java    License: MIT License 6 votes vote down vote up
private static Undertow createServer(int port, String ipAddr) {
  ControllerCommand controller = new ControllerCommand();
  TasksCommand tasks = new TasksCommand();
  ScriptsCommand scripts = new ScriptsCommand(tasks);
  GroupsCommand groups = new GroupsCommand(scripts);

  ResourceManager resourceManager = new ClassPathResourceManager(RunTime.class.getClassLoader(), "htdocs");
  ResourceHandler resource = new ResourceHandler(resourceManager, AbstractCommand.getFallbackHandler());
  resource.addWelcomeFiles("ControlBox.html");

  RoutingHandler commands = Handlers.routing()
          .addAll(controller.getRouting())
          .addAll(tasks.getRouting())
          .addAll(scripts.getRouting())
          .addAll(groups.getRouting())
          .setFallbackHandler(resource);
  CommandRootHttpHandler cmdRoot = new CommandRootHttpHandler(commands);
  cmdRoot.addExceptionHandler(Throwable.class, AbstractCommand.getExceptionHttpHandler());

  Undertow server = Undertow.builder()
          .addHttpListener(port, ipAddr)
          .setServerOption(UndertowOptions.RECORD_REQUEST_START_TIME, true)
          .setHandler(cmdRoot)
          .build();
  return server;
}
 
Example #2
Source Project: quarkus-http   Author: quarkusio   File: ServerSentEventsServer.java    License: Apache License 2.0 5 votes vote down vote up
public static void main(final String[] args) {
    final ServerSentEventHandler sseHandler = serverSentEvents();
    HttpHandler chatHandler = new HttpHandler() {
        @Override
        public void handleRequest(HttpServerExchange exchange) throws Exception {
            new StringReadChannelListener(exchange.getConnection().getByteBufferPool()) {

                @Override
                protected void stringDone(String string) {
                    for(ServerSentEventConnection h : sseHandler.getConnections()) {
                        h.send(string);
                    }
                }

                @Override
                protected void error(IOException e) {

                }
            }.setup(exchange.getRequestChannel());
        }
    };
    Undertow server = Undertow.builder()
            .addHttpListener(8080, "localhost")
            .setHandler(path()
                    .addPrefixPath("/sse", sseHandler)
                    .addPrefixPath("/send", chatHandler)
                    .addPrefixPath("/", resource(new ClassPathResourceManager(ServerSentEventsServer.class.getClassLoader(), ServerSentEventsServer.class.getPackage())).addWelcomeFiles("index.html")))
            .build();
    server.start();
}
 
Example #3
Source Project: greycat   Author: datathings   File: TaskIDE.java    License: Apache License 2.0 5 votes vote down vote up
public static void attach(final WSServer server, final Graph graph) {
    server.addHandler("taskide", new ResourceHandler(new ClassPathResourceManager(TaskIDE.class.getClassLoader(), "taskide")).addWelcomeFiles("index.html").setDirectoryListingEnabled(false));
    server.addHandler("actionregistry", new HttpHandler() {
        @Override
        public void handleRequest(HttpServerExchange httpServerExchange) throws Exception {
            Buffer builder = new HeapBuffer();
            builder.writeString("[");
            ActionRegistry registry = graph.actionRegistry();
            ActionDeclaration[] declarations = registry.declarations();
            for (int i = 0; i < declarations.length; i++) {
                ActionDeclaration declaration = declarations[i];
                if (i != 0) {
                    builder.writeString(",");
                }
                builder.writeString("{\"name\":");
                TaskHelper.serializeString(declaration.name(), builder, false);
                builder.writeString(",\"description\":");
                TaskHelper.serializeString(declaration.description(), builder, false);
                byte[] params = declaration.params();
                if (params != null) {
                    builder.writeString(",\"params\":[");
                    for (int j = 0; j < params.length; j++) {
                        if (j != 0) {
                            builder.writeString(",");
                        }
                        TaskHelper.serializeString(Type.typeName(params[j]), builder, false);
                    }
                    builder.writeString("]");
                }
                builder.writeString("}");
            }
            builder.writeString("]");
            httpServerExchange.getResponseHeaders().add(new HttpString("Access-Control-Allow-Origin"), "*");
            httpServerExchange.setStatusCode(StatusCodes.OK);
            httpServerExchange.getResponseSender().send(builder.toString());
        }
    });

}
 
Example #4
Source Project: greycat   Author: datathings   File: Server.java    License: Apache License 2.0 5 votes vote down vote up
public Server() {
    Undertow server = Undertow.builder().addHttpListener(port, "0.0.0.0",
            Handlers.path()
                    .addPrefixPath("rpc", this)
                    .addPrefixPath("/", new ResourceHandler(new ClassPathResourceManager(Server.class.getClassLoader(), "static")).addWelcomeFiles("index.html").setDirectoryListingEnabled(false))
    ).build();
    server.start();
    System.out.println("Server running at : 9077");
}
 
Example #5
Source Project: joinfaces   Author: joinfaces   File: UndertowAutoConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
public WebServerFactoryCustomizer<UndertowServletWebServerFactory> jsfUndertowFactoryCustomizer(UndertowProperties undertowProperties) {
	return factory -> factory.addDeploymentInfoCustomizers(deploymentInfo -> {
		AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
			deploymentInfo.setResourceManager(new CompositeResourceManager(
				new ClassPathResourceManager(deploymentInfo.getClassLoader(), undertowProperties.getClassPathResource()),
				deploymentInfo.getResourceManager()));

			return null;
		});

		log.info("Setting Undertow classLoader to {} directory", undertowProperties.getClassPathResource());
	});
}
 
Example #6
Source Project: mangooio   Author: svenkubiak   File: Application.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Create routes for WebSockets ServerSentEvent and Resource files
 */
private static void createRoutes() {
    pathHandler = new PathHandler(getRoutingHandler());
    
    Router.getWebSocketRoutes().forEach((WebSocketRoute webSocketRoute) -> 
        pathHandler.addExactPath(webSocketRoute.getUrl(),
                Handlers.websocket(getInstance(WebSocketHandler.class)
                        .withControllerClass(webSocketRoute.getControllerClass())
                        .withAuthentication(webSocketRoute.hasAuthentication())))
    );
    
    Router.getServerSentEventRoutes().forEach((ServerSentEventRoute serverSentEventRoute) ->
        pathHandler.addExactPath(serverSentEventRoute.getUrl(),
                Handlers.serverSentEvents(getInstance(ServerSentEventHandler.class)
                        .withAuthentication(serverSentEventRoute.hasAuthentication())))
    );
    
    Router.getPathRoutes().forEach((PathRoute pathRoute) ->
        pathHandler.addPrefixPath(pathRoute.getUrl(),
                new ResourceHandler(new ClassPathResourceManager(Thread.currentThread().getContextClassLoader(), Default.FILES_FOLDER.toString() + pathRoute.getUrl())))
    );
    
    Config config = getInstance(Config.class);
    if (config.isApplicationAdminEnable()) {
        pathHandler.addPrefixPath("/@admin/assets/", new ResourceHandler(new ClassPathResourceManager(Thread.currentThread().getContextClassLoader(), "templates/@admin/assets/")));            
    }
}
 
Example #7
Source Project: wildfly-core   Author: wildfly   File: ConsoleMode.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
static ResourceHandlerDefinition createConsoleHandler(String slot, String resource) throws ModuleLoadException {
    final ClassPathResourceManager cpresource = new ClassPathResourceManager(getClassLoader(Module.getCallerModuleLoader(), ERROR_MODULE, slot), "");
    final io.undertow.server.handlers.resource.ResourceHandler handler = new io.undertow.server.handlers.resource.ResourceHandler(cpresource)
            .setAllowed(not(path("META-INF")))
            .setResourceManager(cpresource)
            .setDirectoryListingEnabled(false)
            .setCachable(Predicates.<HttpServerExchange>falsePredicate());

    //we also need to setup the default resource redirect
    PredicateHandler predicateHandler = new PredicateHandler(path("/"), new RedirectHandler(ExchangeAttributes.constant(CONTEXT + resource)), handler);
    return new ResourceHandlerDefinition(CONTEXT, resource, predicateHandler);
}
 
Example #8
Source Project: wildfly-core   Author: wildfly   File: ErrorContextHandler.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
public static HttpHandler createErrorContext(final String slot) throws ModuleLoadException {
    final ClassPathResourceManager cpresource = new ClassPathResourceManager(getClassLoader(Module.getCallerModuleLoader(), ERROR_MODULE, slot), "");
    final io.undertow.server.handlers.resource.ResourceHandler handler = new io.undertow.server.handlers.resource.ResourceHandler(cpresource)
            .setAllowed(not(path("META-INF")))
            .setDirectoryListingEnabled(false)
            .setCachable(Predicates.<HttpServerExchange>falsePredicate());

    //we also need to setup the default resource redirect
    return new PredicateHandler(path("/"), new RedirectHandler(ExchangeAttributes.constant(ERROR_CONTEXT + DEFAULT_RESOURCE)), handler);
}
 
Example #9
Source Project: divolte-collector   Author: divolte   File: Server.java    License: Apache License 2.0 5 votes vote down vote up
private static HttpHandler createStaticResourceHandler() {
    final ResourceManager staticResources =
            new ClassPathResourceManager(Server.class.getClassLoader(), "static");
    // Cache tuning is copied from Undertow unit tests.
    final ResourceManager cachedResources =
            new CachingResourceManager(100, 65536,
                                       new DirectBufferCache(1024, 10, 10480),
                                       staticResources,
                                       (int)Duration.ofDays(1).getSeconds());
    final ResourceHandler resourceHandler = new ResourceHandler(cachedResources);
    resourceHandler.setWelcomeFiles("index.html");
    return resourceHandler;
}
 
Example #10
Source Project: tutorials   Author: eugenp   File: SocketServer.java    License: MIT License 5 votes vote down vote up
public static void main(String[] args) {
    Undertow server = Undertow.builder().addHttpListener(8080, "localhost")
            .setHandler(path().addPrefixPath("/baeldungApp", websocket((exchange, channel) -> {
                channel.getReceiveSetter().set(getListener());
                channel.resumeReceives();
            })).addPrefixPath("/", resource(new ClassPathResourceManager(SocketServer.class.getClassLoader(),
                    SocketServer.class.getPackage())).addWelcomeFiles("index.html")))
            .build();

    server.start();
}
 
Example #11
Source Project: symja_android_library   Author: axkr   File: SymjaServer.java    License: GNU General Public License v3.0 5 votes vote down vote up
public static void main(final String[] args) {
	ToggleFeature.COMPILE = false;
	Config.FUZZY_PARSER = true;
	Config.UNPROTECT_ALLOWED = false;
	Config.USE_MANIPULATE_JS = true;
	Config.JAS_NO_THREADS = false;
	// Config.THREAD_FACTORY = com.google.appengine.api.ThreadManager.currentRequestThreadFactory();
	Config.MATHML_TRIG_LOWERCASE = false;
	Config.MAX_AST_SIZE = ((int) Short.MAX_VALUE) * 8;
	Config.MAX_OUTPUT_SIZE = Short.MAX_VALUE;
	Config.MAX_BIT_LENGTH = ((int) Short.MAX_VALUE) * 8;
	Config.MAX_INPUT_LEAVES = 100L;
	Config.MAX_MATRIX_DIMENSION_SIZE = 100;
	EvalEngine.get().setPackageMode(true);
	F.initSymbols(null, null, false);// new SymbolObserver(), false);
	FuzzyParserFactory.initialize();

	final APIHandler apiHandler = new APIHandler();

	PathHandler path = new PathHandler()
			.addPrefixPath("/",
					resource(new ClassPathResourceManager(SymjaServer.class.getClassLoader(),
							SymjaServer.class.getPackage())).addWelcomeFiles("index.html"))
			.addExactPath("/api", apiHandler);

	Undertow server = Undertow.builder().//
			addHttpListener(8080, "localhost").//
			setHandler(path).//
			build();
	server.start();
	System.out.println("started");
}
 
Example #12
Source Project: greycat   Author: datathings   File: WSSharedServerTest.java    License: Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {
    final Graph graph = new GraphBuilder()
            .withMemorySize(10000)
            .build();
    graph.connect(new Callback<Boolean>() {
        @Override
        public void on(Boolean connectResult) {
            WSSharedServer graphServer = new WSSharedServer(graph, 8050);
            graphServer.addHandler("hello", new ResourceHandler(new ClassPathResourceManager(this.getClass().getClassLoader(), "hello")).addWelcomeFiles("index.html").setDirectoryListingEnabled(true));
            graphServer.start();
            System.out.println("Connected!");


            Node root = graph.newNode(0, 0);
            root.set("name", Type.STRING, "root");

            Node n0 = graph.newNode(0, 0);
            n0.set("name", Type.STRING, "n0");

            Node n1 = graph.newNode(0, 0);
            n1.set("name", Type.STRING, "n0");

            root.addToRelation("children", n0);
            root.addToRelation("children", n1);

            graph.declareIndex(0, "nodes", new Callback<NodeIndex>() {
                @Override
                public void on(NodeIndex indexNode) {
                    indexNode.update(root);
                    System.out.println(indexNode.toString());
                    StateChunk chunk = (StateChunk) graph.space().get(((BaseNode) indexNode)._index_stateChunk);
                    Buffer buffer = graph.newBuffer();
                    chunk.save(buffer);

                    System.out.println(new String(buffer.data()));
                    System.out.println(chunk.index());
                }
            }, "name");
        }
    });
}
 
Example #13
Source Project: greycat   Author: datathings   File: VisualizerServer.java    License: Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) {
    if(args.length == 2) {
        try {
            serverPort = Integer.parseInt(args[0]);
        } catch (NumberFormatException ex) {
            System.err.println(ex.getMessage());
            printHelp();
            System.exit(2);
        }
        urltoConnect = args[1];
    } else if(args.length != 0) {
        printHelp();
        return;
    }


    Undertow server = Undertow.builder()
            .addHttpListener(serverPort,serverUrl)
            .setHandler(
                    Handlers.path(
                            Handlers.resource(new ClassPathResourceManager(VisualizerServer.class.getClassLoader()))
                    )
            )
            .build();


    server.start();

    StringBuilder goToBuilder = new StringBuilder();
    goToBuilder.append("http://")
            .append(serverUrl)
            .append(":")
            .append(serverPort);
    if(urltoConnect != null) {
        goToBuilder.append("?q=")
                .append(urltoConnect);
    }

    System.out.println("Go to: " + goToBuilder);

}
 
Example #14
Source Project: jersey-jwt   Author: cassiomolin   File: Application.java    License: MIT License 4 votes vote down vote up
/**
 * Start server on the given port.
 *
 * @param port
 */
public static void startServer(int port) {

    LOGGER.info(String.format("Starting server on port %d", port));

    PathHandler path = Handlers.path();

    server = Undertow.builder()
            .addHttpListener(port, "localhost")
            .setHandler(path)
            .build();

    server.start();

    LOGGER.info(String.format("Server started on port %d", port));

    DeploymentInfo servletBuilder = Servlets.deployment()
            .setClassLoader(Application.class.getClassLoader())
            .setContextPath("/")
            .addListeners(listener(Listener.class))
            .setResourceManager(new ClassPathResourceManager(Application.class.getClassLoader()))
            .addServlets(
                    Servlets.servlet("jerseyServlet", ServletContainer.class)
                            .setLoadOnStartup(1)
                            .addInitParam("javax.ws.rs.Application", JerseyConfig.class.getName())
                            .addMapping("/api/*"))
            .setDeploymentName("application.war");

    LOGGER.info("Starting application deployment");

    deploymentManager = Servlets.defaultContainer().addDeployment(servletBuilder);
    deploymentManager.deploy();

    try {
        path.addPrefixPath("/", deploymentManager.start());
    } catch (ServletException e) {
        throw new RuntimeException(e);
    }

    LOGGER.info("Application deployed");
}
 
Example #15
Source Project: mangooio   Author: svenkubiak   File: Application.java    License: Apache License 2.0 4 votes vote down vote up
private static RoutingHandler getRoutingHandler() {
    final RoutingHandler routingHandler = Handlers.routing();
    routingHandler.setFallbackHandler(Application.getInstance(FallbackHandler.class));
    
    Config config = getInstance(Config.class);
    if (config.isApplicationAdminEnable()) {
        Bind.controller(AdminController.class)
            .withRoutes(
                    On.get().to("/@admin").respondeWith("index"),
                    On.get().to("/@admin/login").respondeWith("login"),
                    On.get().to("/@admin/twofactor").respondeWith("twofactor"),
                    On.get().to("/@admin/scheduler").respondeWith("scheduler"),
                    On.get().to("/@admin/logger").respondeWith("logger"),
                    On.get().to("/@admin/routes").respondeWith("routes"),
                    On.get().to("/@admin/tools").respondeWith("tools"),
                    On.get().to("/@admin/scheduler/execute/{name}").respondeWith("execute"),
                    On.get().to("/@admin/scheduler/state/{name}").respondeWith("state"),   
                    On.get().to("/@admin/logout").respondeWith("logout"),
                    On.post().to("/@admin/authenticate").respondeWith("authenticate"),
                    On.post().to("/@admin/verify").respondeWith("verify"),
                    On.post().to("/@admin/logger/ajax").respondeWith("loggerajax"),
                    On.post().to("/@admin/tools/ajax").respondeWith("toolsajax")
             );
    }

    Router.getRequestRoutes().forEach((RequestRoute requestRoute) -> {
        DispatcherHandler dispatcherHandler = Application.getInstance(DispatcherHandler.class)
                .dispatch(requestRoute.getControllerClass(), requestRoute.getControllerMethod())
                .isBlocking(requestRoute.isBlocking())
                .withBasicAuthentication(requestRoute.getUsername(), requestRoute.getPassword())
                .withAuthentication(requestRoute.hasAuthentication())
                .withAuthorization(requestRoute.hasAuthorization())
                .withLimit(requestRoute.getLimit());
        
        routingHandler.add(requestRoute.getMethod().toString(), requestRoute.getUrl(), dispatcherHandler);  
    });
    
    ResourceHandler resourceHandler = Handlers.resource(new ClassPathResourceManager(
            Thread.currentThread().getContextClassLoader(),
            Default.FILES_FOLDER.toString() + '/'));
    
    Router.getFileRoutes().forEach((FileRoute fileRoute) -> routingHandler.add(Methods.GET, fileRoute.getUrl(), resourceHandler));
    
    return routingHandler;
}
 
Example #16
Source Project: wildfly-core   Author: wildfly   File: ConsoleMode.java    License: GNU Lesser General Public License v2.1 4 votes vote down vote up
static ResourceHandlerDefinition createConsoleHandler(String skin) throws ModuleLoadException {
    final ClassPathResourceManager resource = new ClassPathResourceManager(findConsoleClassLoader(Module.getCallerModuleLoader(), skin), "");
    return DomainUtil.createStaticContentHandler(resource, CONTEXT);

}
 
Example #17
Source Project: seed   Author: seedstack   File: DeploymentManagerFactory.java    License: Mozilla Public License 2.0 4 votes vote down vote up
@SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST_OF_RETURN_VALUE", justification = "False positive")
private DeploymentInfo configureDeploymentInfo() {
    // Basic deployment attributes
    DeploymentInfo deploymentInfo = Servlets.deployment()
            .setEagerFilterInit(true)
            .setClassLoader(mostCompleteClassLoader)
            .setDeploymentName(applicationConfig.getId())
            .setDisplayName(applicationConfig.getName())
            .setDefaultSessionTimeout(serverConfig.getDefaultSessionTimeout())
            .setResourceManager(new ClassPathResourceManager(mostCompleteClassLoader, META_INF_RESOURCES))
            .addWelcomePages(serverConfig.getWelcomeFiles())
            .addErrorPages(buildUndertowErrorPages(serverConfig.getErrorPages()))
            .setContextPath(serverConfig.getContextPath());

    // Configure WebSockets if enabled
    if (serverConfig.webSocket().isEnabled()) {
        LOGGER.info("WebSocket support is enabled");
        deploymentInfo.addServletContextAttribute(
                WebSocketDeploymentInfo.ATTRIBUTE_NAME,
                new WebSocketDeploymentInfo()
                        .setBuffers(new DefaultByteBufferPool(
                                undertowConfig.isDirectBuffers(),
                                undertowConfig.getBufferSize()))
                        .setWorker(xnioWorker)
        );
    }

    // Redirect to HTTPS if configured
    if (serverConfig.isHttp() && serverConfig.isHttps() && serverConfig.isPreferHttps()) {
        LOGGER.info("Automatic redirection to HTTPS is enabled");
        deploymentInfo
                .addSecurityConstraint(new SecurityConstraint()
                        .addWebResourceCollection(new WebResourceCollection().addUrlPattern("/*"))
                        .setTransportGuaranteeType(TransportGuaranteeType.CONFIDENTIAL)
                        .setEmptyRoleSemantic(SecurityInfo.EmptyRoleSemantic.PERMIT))
                .setConfidentialPortManager(ex -> serverConfig.getSecurePort());
    }

    // Add custom init parameters
    for (Map.Entry<String, String> initParameter : initParameters.entrySet()) {
        LOGGER.debug("Servlet init parameter {} = {}", initParameter.getKey(), initParameter.getValue());
        deploymentInfo.addInitParameter(initParameter.getKey(), initParameter.getValue());
    }

    // Register ServletContainerInitializers
    for (ServletContainerInitializer sci : loadServletContainerInitializers()) {
        LOGGER.debug("Registering ServletContainerInitializer {}", sci.getClass().getName());
        deploymentInfo.addServletContainerInitializer(createServletContainerInitializerInfo(sci));
    }

    return deploymentInfo;
}
 
Example #18
Source Project: hammock   Author: hammock-project   File: UndertowWebServer.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void start() {
    DeploymentInfo di = new DeploymentInfo()
            .setContextPath("/")
            .setDeploymentName("Undertow")
            .setResourceManager(new ClassPathResourceManager(getClass().getClassLoader()))
            .setClassLoader(ClassLoader.getSystemClassLoader());

    super.getListeners().forEach(c ->di.addListener(listener(c)));

    Collection<Class<?>> endpoints = extension.getEndpointClasses();
    if(!endpoints.isEmpty()) {
        WebSocketDeploymentInfo webSocketDeploymentInfo = new WebSocketDeploymentInfo();
        endpoints.forEach(webSocketDeploymentInfo::addEndpoint);
        di.addServletContextAttribute(WebSocketDeploymentInfo.ATTRIBUTE_NAME, webSocketDeploymentInfo);
    }

    getServletContextAttributes().forEach(di::addServletContextAttribute);
    servlets.forEach(di::addServlet);
    getFilterDescriptors().forEach(filterDescriptor -> {
        FilterInfo filterInfo = filter(filterDescriptor.displayName(), filterDescriptor.getClazz()).setAsyncSupported(filterDescriptor.asyncSupported());
        if(filterDescriptor.initParams() != null) {
            for (WebInitParam param : filterDescriptor.initParams()) {
                filterInfo.addInitParam(param.name(), param.value());
            }
        }
        di.addFilter(filterInfo);
        for(String url : filterDescriptor.urlPatterns()) {
            for(DispatcherType dispatcherType : filterDescriptor.dispatcherTypes()) {
                di.addFilterUrlMapping(filterDescriptor.displayName(), url, dispatcherType);
            }
        }
    });

    getInitParams().forEach(di::addInitParameter);

    DeploymentManager deploymentManager = Servlets.defaultContainer().addDeployment(di);
    deploymentManager.deploy();
    try {
        HttpHandler servletHandler = deploymentManager.start();
        PathHandler path = path(Handlers.redirect("/"))
                .addPrefixPath("/", servletHandler);
        Builder undertowBuilder = Undertow.builder()
                .addHttpListener(webServerConfiguration.getPort(), webServerConfiguration.getAddress())
                .setHandler(path);
        if (hammockRuntime.isSecuredConfigured()){
        	KeyManager[] keyManagers = loadKeyManager();
        	TrustManager[] trustManagers = loadTrustManager();
        	SSLContext sslContext = SSLContext.getInstance("TLS");
            sslContext.init(keyManagers, trustManagers, null);
        	undertowBuilder = undertowBuilder.addHttpsListener(webServerConfiguration.getSecuredPort(), webServerConfiguration.getAddress(), sslContext);
        }
        this.undertow = undertowBuilder.build();
        this.undertow.start();
    } catch (ServletException | GeneralSecurityException | IOException e) {
        throw new RuntimeException("Unable to start server", e);
    }
}