Hi,
I'd appreciate help in understanding how to setup handlers. I want paths
that begin with "/api" to be handled by JAXRS and all others to be handled
by the file resource manager.
I'm confused as to why using the defaultContainer works, but using a
servlet container factory instance doesn't. When I use the defaultContainer
approach, executing a curl GET command against
http://localhost:8080/api/example works as expected, however, if I use the
servlet container factory, the endpoint is not found.
DeploymentManager manager =
Servlets.defaultContainer().addDeployment(deployInfo);
// But if I switch the container to:
// ServletContainer.Factory.newInstance().addDeployment(deployInfo)
// and add a path handler:
// private final PathHandler pathHandler = new PathHandler();
// pathHandler.addExactPath("/api", manager.start());
// and then set the handler:
// .setHandler(pathHandler)
// the endpoint(s) aren't found
try {
server = Undertow.builder()
.addHttpListener((int) conf.get("port"),
conf.get("host").toString())
.setHandler(manager.start())
.build();
} catch (NumberFormatException | ServletException e) {
logger.error("Undertow server build error: {}", e.getMessage());
}
Thanks.
-Ari