Hi,
I recently found some articles which shows undertow has excellent performance especially because of asynchronous non-blocking io. So I am trying to do a PoC to see if it fits our needs.
I tried to deploy our war file with embedded undertow. Below is the sample code, warpath is the absolute path for war file.
Server starts up but doesn’t do anything. It works fine if I put undertow inside the war and explicitly adds servlets and filters to undertow, but we are interested in keeping war independent of any container libraries.
Our application Servlet Context Listener would add servlets and filters. Application will create a war and we are trying to deploy that war to undertow. Is it possible to do that? Can you please show how to do it? Any help is deeply appreciated.
DeploymentInfo servletBuilder = Servlets.deployment()
.setClassLoader(Startup.class.getClassLoader())
.setContextPath("/")
.setDeploymentName(warPath);
DeploymentManager manager = Servlets.defaultContainer().addDeployment(servletBuilder);
manager.deploy();
Undertow server = Undertow.builder()
.addHttpListener(8080, "localhost")
.setHandler(manager.start()).build();
server.start();
Thank you,
Dharmesh Data