<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">Stuart:</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Many thanks for the changes. Where I can get the version 1.4.23.Final?</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Best Regards</p>
<br>
<div style="color: rgb(0, 0, 0);">
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Stuart Douglas &lt;sdouglas@redhat.com&gt;<br>
<b>Sent:</b> Monday, January 22, 2018 9:25 PM<br>
<b>To:</b> Fernando Cruz<br>
<b>Subject:</b> Re: Handlers routing</font>
<div>&nbsp;</div>
</div>
<div>
<div dir="ltr">
<div>This looks like a bug, I have filed&nbsp;<a href="https://issues.jboss.org/browse/UNDERTOW-1272" id="LPlnk472396" previewremoved="true">https://issues.jboss.org/browse/UNDERTOW-1272</a>.</div>
<div><br>
</div>
<div>I am a bit worried that it may cause minor compat problems, but if so they can be fixed by removing the trailing / from the template.</div>
<div><br>
<div>Stuart</div>
</div>
</div>
<div class="x_gmail_extra"><br>
<div class="x_gmail_quote">On Tue, Jan 23, 2018 at 4:40 AM, Fernando Cruz <span dir="ltr">
&lt;<a href="mailto:boggard@hotmail.com" target="_blank">boggard@hotmail.com</a>&gt;</span> wrote:<br>
<blockquote class="x_gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<div id="x_m_-3187669535850122436divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p style="margin-top:0; margin-bottom:0"><span style="font-size:11pt">Hi,</span><br>
</p>
<div style="color:rgb(0,0,0)">
<div class="x_m_-3187669535850122436BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="x_m_-3187669535850122436PlainText"><br>
I have an issue with the path template for the built in handler &quot;Handlers.routing&quot;, when execute this implementation:<br>
<br>
public class UndertowOnePathVariableApplica<wbr>tion {<br>
<br>
&nbsp; private static final Logger LOGGER = LoggerFactory.getLogger(<wbr>UndertowOnePathVariableApplica<wbr>tion.class);<br>
<br>
&nbsp; public static void main(final String[] args) {<br>
<br>
&nbsp;&nbsp;&nbsp; Undertow.builder()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .addHttpListener(8080, &quot;localhost&quot;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .setHandler(<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Handlers.routing()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .get(&quot;/api/v1/orders/&quot;, (exchange) -&gt; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LOGGER.info(&quot;The path template defined is '/api/v1/orders/'&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LOGGER.info(&quot;The request URI '{}' and URL '{}'&quot;, exchange.getRequestURI(), exchange.getRequestURL());<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exchange.getResponseHeaders().<wbr>put(Headers.CONTENT_TYPE, &quot;text/plain&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exchange.setStatusCode(<wbr>StatusCodes.OK)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .getResponseSender().send(&quot;All Orders&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; })<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .get(&quot;/api/v1/orders/{orderId}<wbr>&quot;, (exchange) -&gt; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LOGGER.info(&quot;The path template defined is '/api/v1/orders/{orderId}'&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LOGGER.info(&quot;The request URI '{}' and URL '{}'&quot;, exchange.getRequestURI(), exchange.getRequestURL());<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exchange.getResponseHeaders().<wbr>put(Headers.CONTENT_TYPE, &quot;text/plain&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exchange.setStatusCode(<wbr>StatusCodes.OK)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .getResponseSender().send(<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;Order '&quot; &#43; exchange.getQueryParameters().<wbr>get(&quot;orderId&quot;).getLast() &#43; &quot;'&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .build()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .start();<br>
<br>
&nbsp; }<br>
<br>
}<br>
<br>
I get this responses:<br>
<br>
boggard@xiuhcoatl:~$ curl -v '<a href="http://localhost:8080/api/v1/orders" id="x_m_-3187669535850122436LPlnk364853" target="_blank">http://localhost:8080/api/v1/<wbr>orders</a>'<br>
*&nbsp;&nbsp; Trying 127.0.0.1...<br>
* TCP_NODELAY set<br>
* Connected to localhost (127.0.0.1) port 8080 (#0)<br>
&gt; GET /api/v1/orders HTTP/1.1<br>
&gt; Host: localhost:8080<br>
&gt; User-Agent: curl/7.56.0<br>
&gt; Accept: */*<br>
&gt;<br>
&lt; HTTP/1.1 404 Not Found<br>
&lt; Connection: keep-alive<br>
&lt; Content-Length: 0<br>
&lt; Date: Sun, 21 Jan 2018 02:01:53 GMT<br>
&lt;<br>
* Connection #0 to host localhost left intact<br>
<br>
boggard@xiuhcoatl:~$ curl -v '<a href="http://localhost:8080/api/v1/orders/" id="x_m_-3187669535850122436LPlnk208681" target="_blank">http://localhost:8080/api/v1/<wbr>orders/</a>'<br>
*&nbsp;&nbsp; Trying 127.0.0.1...<br>
* TCP_NODELAY set<br>
* Connected to localhost (127.0.0.1) port 8080 (#0)<br>
&gt; GET /api/v1/orders/ HTTP/1.1<br>
&gt; Host: localhost:8080<br>
&gt; User-Agent: curl/7.56.0<br>
&gt; Accept: */*<br>
&gt;<br>
&lt; HTTP/1.1 200 OK<br>
&lt; Connection: keep-alive<br>
&lt; Content-Type: text/plain<br>
&lt; Content-Length: 10<br>
&lt; Date: Sun, 21 Jan 2018 02:02:45 GMT<br>
&lt;<br>
* Connection #0 to host localhost left intact<br>
All Orders<br>
<br>
boggard@xiuhcoatl:~$ curl -v '<a href="http://localhost:8080/api/v1/orders/12345" target="_blank">http://localhost:8080/api/v1/<wbr>orders/12345</a>'<br>
*&nbsp;&nbsp; Trying 127.0.0.1...<br>
* TCP_NODELAY set<br>
* Connected to localhost (127.0.0.1) port 8080 (#0)<br>
&gt; GET /api/v1/orders/12345 HTTP/1.1<br>
&gt; Host: localhost:8080<br>
&gt; User-Agent: curl/7.56.0<br>
&gt; Accept: */*<br>
&gt;<br>
&lt; HTTP/1.1 200 OK<br>
&lt; Connection: keep-alive<br>
&lt; Content-Type: text/plain<br>
&lt; Content-Length: 13<br>
&lt; Date: Sun, 21 Jan 2018 02:03:56 GMT<br>
&lt;<br>
* Connection #0 to host localhost left intact<br>
Order '12345'<br>
<br>
That I thing is correct because I just define two paths: '.../orders/' and '.../orders/{orderId}'. And the path '.../orders', that is not defined, respond 404. But when use this implementation:<br>
<br>
public class UndertowTwoPathVariablesApplic<wbr>ation {<br>
<br>
&nbsp; private static final Logger LOGGER = LoggerFactory.getLogger(<wbr>UndertowTwoPathVariablesApplic<wbr>ation.class);<br>
<br>
&nbsp; public static void main(final String[] args) {<br>
<br>
&nbsp;&nbsp;&nbsp; Undertow.builder()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .addHttpListener(8080, &quot;localhost&quot;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .setHandler(<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Handlers.routing()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .get(&quot;/api/v1/orders/{orderId}<wbr>/items/&quot;, (exchange) -&gt; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LOGGER.info(&quot;The path template defined is '/api/v1/orders/{orderId}/<wbr>items/'&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LOGGER.info(&quot;The request URI '{}' and URL '{}'&quot;, exchange.getRequestURI(), exchange.getRequestURL());<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exchange.getResponseHeaders().<wbr>put(Headers.CONTENT_TYPE, &quot;text/plain&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exchange.setStatusCode(<wbr>StatusCodes.OK)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .getResponseSender().send(<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;Order '&quot; &#43; exchange.getQueryParameters().<wbr>get(&quot;orderId&quot;).getLast() &#43; &quot;'&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; })<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .get(&quot;/api/v1/orders/{orderId}<wbr>/items/{itemId}&quot;, (exchange) -&gt; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LOGGER.info(&quot;The path template defined is '/api/v1/orders/{orderId}/<wbr>items/{itemId}'&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LOGGER.info(&quot;The request URI '{}' and URL '{}'&quot;, exchange.getRequestURI(), exchange.getRequestURL());<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exchange.getResponseHeaders().<wbr>put(Headers.CONTENT_TYPE, &quot;text/plain&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exchange.setStatusCode(<wbr>StatusCodes.OK)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .getResponseSender().send(<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;Order '&quot; &#43; exchange.getQueryParameters().<wbr>get(&quot;orderId&quot;).getLast() &#43;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;' Item '&quot; &#43; exchange.getQueryParameters().<wbr>get(&quot;itemId&quot;).getLast() &#43; &quot;'&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .build()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .start();<br>
<br>
&nbsp; }<br>
<br>
}<br>
<br>
I get this responses:<br>
<br>
boggard@xiuhcoatl:~$ curl -v '<a href="http://localhost:8080/api/v1/orders/12345/items" target="_blank">http://localhost:8080/api/v1/<wbr>orders/12345/items</a>'<br>
*&nbsp;&nbsp; Trying 127.0.0.1...<br>
* TCP_NODELAY set<br>
* Connected to localhost (127.0.0.1) port 8080 (#0)<br>
&gt; GET /api/v1/orders/12345/items HTTP/1.1<br>
&gt; Host: localhost:8080<br>
&gt; User-Agent: curl/7.56.0<br>
&gt; Accept: */*<br>
&gt;<br>
&lt; HTTP/1.1 200 OK<br>
&lt; Connection: keep-alive<br>
&lt; Content-Type: text/plain<br>
&lt; Content-Length: 13<br>
&lt; Date: Sun, 21 Jan 2018 02:08:45 GMT<br>
&lt;<br>
* Connection #0 to host localhost left intact<br>
Order '12345'<br>
<br>
boggard@xiuhcoatl:~$ curl -v '<a href="http://localhost:8080/api/v1/orders/12345/items/" target="_blank">http://localhost:8080/api/v1/<wbr>orders/12345/items/</a>'<br>
*&nbsp;&nbsp; Trying 127.0.0.1...<br>
* TCP_NODELAY set<br>
* Connected to localhost (127.0.0.1) port 8080 (#0)<br>
&gt; GET /api/v1/orders/12345/items/ HTTP/1.1<br>
&gt; Host: localhost:8080<br>
&gt; User-Agent: curl/7.56.0<br>
&gt; Accept: */*<br>
&gt;<br>
&lt; HTTP/1.1 200 OK<br>
&lt; Connection: keep-alive<br>
&lt; Content-Type: text/plain<br>
&lt; Content-Length: 21<br>
&lt; Date: Sun, 21 Jan 2018 02:09:11 GMT<br>
&lt;<br>
* Connection #0 to host localhost left intact<br>
Order '12345' Item ''<br>
&nbsp; <br>
boggard@xiuhcoatl:~$ curl -v '<a href="http://localhost:8080/api/v1/orders/12345/items/09876" target="_blank">http://localhost:8080/api/v1/<wbr>orders/12345/items/09876</a>'<br>
*&nbsp;&nbsp; Trying 127.0.0.1...<br>
* TCP_NODELAY set<br>
* Connected to localhost (127.0.0.1) port 8080 (#0)<br>
&gt; GET /api/v1/orders/12345/items/<wbr>09876 HTTP/1.1<br>
&gt; Host: localhost:8080<br>
&gt; User-Agent: curl/7.56.0<br>
&gt; Accept: */*<br>
&gt;<br>
&lt; HTTP/1.1 200 OK<br>
&lt; Connection: keep-alive<br>
&lt; Content-Type: text/plain<br>
&lt; Content-Length: 26<br>
&lt; Date: Sun, 21 Jan 2018 02:09:30 GMT<br>
&lt;<br>
* Connection #0 to host localhost left intact<br>
Order '12345' Item '09876'<br>
<br>
That I thing is incorrect because there are just two paths again: '.../orders/{orderId}/items/' and '.../orders/{orderId}/items/{<wbr>itemId}' but the curl with the exact URI use the second path template. Is this an issue or what I am doing wrong?<br>
<br>
Best Regards<span class="x_HOEnZb"><font color="#888888"><br>
<br>
Fernando Cruz<br>
</font></span></div>
</span></font></div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</body>
</html>