<div dir="ltr">Hi,<br><div class="gmail_quote"><div dir="ltr"><div><div><div><div><div><div><br></div>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. <br>
<br>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 <a href="http://localhost:8080/api/example" target="_blank">http://localhost:8080/api/example</a> works as expected, however, if I use the servlet container factory, the endpoint is not found.<br>
<br> DeploymentManager manager = Servlets.defaultContainer().addDeployment(deployInfo);<br><br></div>// But if I switch the container to:<br>// ServletContainer.Factory.newInstance().addDeployment(deployInfo)<br></div>// and add a path handler:<br>
// private final PathHandler pathHandler = new PathHandler();<br>// pathHandler.addExactPath("/api", manager.start());<br></div>// and then set the handler:<br></div>// .setHandler(pathHandler)<br></div>// the endpoint(s) aren't found<br>
<div><div><br><div><div><div> try {<br> server = Undertow.builder()<br> .addHttpListener((int) conf.get("port"), conf.get("host").toString())<br> .setHandler(manager.start())<br>
.build();<br> } catch (NumberFormatException | ServletException e) {<br> logger.error("Undertow server build error: {}", e.getMessage());<br> }<br><br><br><br></div><div>Thanks.<span class="HOEnZb"><font color="#888888"><br>
<br></font></span></div><span class="HOEnZb"><font color="#888888"><div>-Ari<br></div></font></span></div></div></div></div></div>
</div><br></div>