It looks like this issue would be cause by your use of the PathHandler,
rather than changing to a new ServletContainer (there should be no real
difference between using your own and using the default).
In your Servlet deployment are your JAX-RS handlers mapped under /api?
If so you are then adding another /api to the path, so the resulting
path end up being
http://localhost:8080/api/api/example. If you omit the
path handler (or register this deployment under '/', if you still want
to be able to have other deployments registered under different
contexts) then it should work.
Stuart
Ari King wrote:
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
_______________________________________________
undertow-dev mailing list
undertow-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/undertow-dev