<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hi,</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">I define two template paths with the following implementation:</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"></p>
<div><span style="font-size: 12pt;">public class UndertowTwoPathVariablesApplication {</span><br>
</div>
<div><br>
</div>
<div> private static final Logger LOGGER = LoggerFactory.getLogger(UndertowTwoPathVariablesApplication.class);</div>
<div><br>
</div>
<div> public static void main(final String[] args) {</div>
<div><br>
</div>
<div> Undertow.builder()</div>
<div> .addHttpListener(8080, "localhost")</div>
<div> .setHandler(</div>
<div> Handlers.routing()</div>
<div> .get("/api/v1/orders/{orderId}/items/", (exchange) -> {</div>
<div> LOGGER.info("The path template defined is '/api/v1/orders/{orderId}/items/'");</div>
<div> LOGGER.info("The request URI '{}'", exchange.getRequestURI());</div>
<div> exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/plain");</div>
<div> exchange.setStatusCode(StatusCodes.OK)</div>
<div> .getResponseSender().send("Retrieve all Items of the Order '"</div>
<div> + exchange.getQueryParameters().get("orderId").getLast() + "'");</div>
<div> })</div>
<div> .get("/api/v1/orders/{orderId}/items/{itemId}", (exchange) -> {</div>
<div> LOGGER.info("The path template defined is '/api/v1/orders/{orderId}/items/{itemId}'");</div>
<div> LOGGER.info("The request URI '{}'", exchange.getRequestURI());</div>
<div> exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/plain");</div>
<div> exchange.setStatusCode(StatusCodes.OK)</div>
<div> .getResponseSender().send(</div>
<div> "Retrieve the Item '" + exchange.getQueryParameters().get("itemId").getLast()</div>
<div> + "' of the Order '" + exchange.getQueryParameters().get("orderId").getLast() + "'");</div>
<div> }))</div>
<div> .build()</div>
<div> .start();</div>
<div><br>
</div>
<div> }</div>
<div><br>
</div>
<div>}</div>
<div><br>
</div>
And using the version 2.0.0.Beta1 of undertow-core I can not enter to the first Handler defined.
<p></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"></p>
<div>boggard@xiuhcoatl:~$ curl -v 'http://localhost:8080/api/v1/orders/12345/items'</div>
<div>* Trying 127.0.0.1...</div>
<div>* TCP_NODELAY set</div>
<div>* Connected to localhost (127.0.0.1) port 8080 (#0)</div>
<div>> GET /api/v1/orders/12345/items HTTP/1.1</div>
<div>> Host: localhost:8080</div>
<div>> User-Agent: curl/7.58.0</div>
<div>> Accept: */*</div>
<div>></div>
<div>< HTTP/1.1 404 Not Found</div>
<div>< Connection: keep-alive</div>
<div>< Content-Length: 0</div>
<div>< Date: Fri, 02 Feb 2018 08:08:48 GMT</div>
<div><</div>
<div>* Connection #0 to host localhost left intact</div>
<br>
<p></p>
<p style="margin-top:0;margin-bottom:0"></p>
<div>boggard@xiuhcoatl:~$ curl -v 'http://localhost:8080/api/v1/orders/12345/items/'</div>
<div>* Trying 127.0.0.1...</div>
<div>* TCP_NODELAY set</div>
<div>* Connected to localhost (127.0.0.1) port 8080 (#0)</div>
<div>> GET /api/v1/orders/12345/items/ HTTP/1.1</div>
<div>> Host: localhost:8080</div>
<div>> User-Agent: curl/7.58.0</div>
<div>> Accept: */*</div>
<div>></div>
<div>< HTTP/1.1 200 OK</div>
<div>< Connection: keep-alive</div>
<div>< Content-Type: text/plain</div>
<div>< Content-Length: 41</div>
<div>< Date: Fri, 02 Feb 2018 08:09:15 GMT</div>
<div><</div>
<div>* Connection #0 to host localhost left intact</div>
<div>Retrieve the Item '' of the Order '12345'</div>
<br>
<p></p>
<p style="margin-top:0;margin-bottom:0"></p>
<div>boggard@xiuhcoatl:~$ curl -v 'http://localhost:8080/api/v1/orders/12345/items/'</div>
<div>* Trying 127.0.0.1...</div>
<div>* TCP_NODELAY set</div>
<div>* Connected to localhost (127.0.0.1) port 8080 (#0)</div>
<div>> GET /api/v1/orders/12345/items/ HTTP/1.1</div>
<div>> Host: localhost:8080</div>
<div>> User-Agent: curl/7.58.0</div>
<div>> Accept: */*</div>
<div>></div>
<div>< HTTP/1.1 200 OK</div>
<div>< Connection: keep-alive</div>
<div>< Content-Type: text/plain</div>
<div>< Content-Length: 41</div>
<div>< Date: Fri, 02 Feb 2018 08:09:15 GMT</div>
<div><</div>
<div>* Connection #0 to host localhost left intact</div>
<div>Retrieve the Item '' of the Order '12345'</div>
<p></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">This not happen when the path have just one path variable. I create the repo <a href="https://github.com/b0gg4rd/undertow-path-variable" class="OWAAutoLink" id="LPlnk490938" previewremoved="true">https://github.com/b0gg4rd/undertow-path-variable</a> with
the two implementations.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Best Regards</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<div id="Signature">Fernando Cruz<br>
<br>
</div>
</div>
</body>
</html>