<div dir="ltr">Thanks for the tip. I was only able to get the parameters if the constructor for the RoutingHandler was set to true (rewrite as query params).<div><br></div><div>If it is set to false, I'm not seeing them show up in pathParameters. It is still null. </div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Apr 20, 2014 at 8:03 PM, Bill O'Neil <span dir="ltr"><<a href="mailto:bill@dartalley.com" target="_blank">bill@dartalley.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I believe by default all path parameters will be written as query parameters. You can read them the same way you read query parameters. However if you have a path parameter and a query parameter with the same name this can cause issues. There is a flag to NOT rewrite path parameters as query params if you wish to use that. There is a second way to get the path parameter values but I cannot remember it off of the top of my head.<br>
</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Apr 20, 2014 at 10:59 PM, Jonathan Hart <span dir="ltr"><<a href="mailto:jonathan.hart@gmail.com" target="_blank">jonathan.hart@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Stuart,<div><br></div><div>I was able to successfully set up a RoutingHandler, and it is matching templates correctly. However, how do I get access to the {variable} data itself once inside my matched handler?</div>
<div><br></div><div>I have looked through all of the Handler methods/props and the only place I see the values are in the relative path, which would require me to re-parse the URL to get to the data I need..</div><div><br>
</div><div>A quick example is:</div><div><br></div><div>/user/{userId}</div><div><br></div><div>Which is matched when someone requests something like:</div><div><br></div><div>/user/5</div><div><br></div><div>How do I get access to the "5"? Perhaps I'm too new to Undertow to miss something obvious, but some advice would be appreciated!</div>
</div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 15, 2014 at 6:16 PM, Bill O'Neil <span dir="ltr"><<a href="mailto:oneil5045@gmail.com" target="_blank">oneil5045@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks for the quick response. This is exactly what I was looking for.<span><font color="#888888"><div>
<br></div><div>Bill</div></font></span></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 15, 2014 at 7:27 PM, Jonathan Hart <span dir="ltr"><<a href="mailto:jonathan.hart@gmail.com" target="_blank">jonathan.hart@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi everyone (new to this list)<div><br></div><div>Many thanks for making this, I was trying to do the EXACT same thing with Undertow and was having a very hard time wrapping my head around predicates. </div>
</div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Apr 14, 2014 at 5:38 PM, Stuart Douglas <span dir="ltr"><<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br>
<br>
Bill O'Neil wrote:<br>
> I was curious what the best practices would be for url routing with many<br>
> endpoints.<br>
><br>
> For example<br>
><br>
> POST /user/<br>
> GET /user/{userId}<br>
> GET /document/{documentId} ContentType=appliction/json (only respond<br>
> when json is requested)<br>
><br>
> What would be the best option for this? I was able to achieve most of<br>
> what i wanted using the PredicatesHandler class. Is this a good choice?<br>
<br>
</div>That will work fine, although there are more efficient ways to do this.<br>
I think this will actually be a fairly common use case, so I have added<br>
a handler to handle this:<br>
<br>
<a href="https://github.com/undertow-io/undertow/commit/04385f29996673658bce3c131de4e0a32241e78e#diff-3" target="_blank">https://github.com/undertow-io/undertow/commit/04385f29996673658bce3c131de4e0a32241e78e#diff-3</a><br>
<br>
<br>
Basically it matches requests based on a combination of method, path<br>
template and predicate, and will be considerably more efficient that<br>
testing a list of predicates.<br>
<br>
Stuart<br>
<div><br>
<br>
<br>
><br>
> This would build a List of PredicatedHandlers as well as the fall<br>
> through handler which I would use as a 404. I got an example working<br>
> using the text predicate format<br>
><br>
> method[GET] and path-template[value=\"/user/{userId}\"]<br>
><br>
><br>
> Is this a good approach or are there better recommendations?<br>
><br>
><br>
> Thanks,<br>
><br>
> Bill<br>
><br>
</div>> _______________________________________________<br>
> undertow-dev mailing list<br>
> <a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/undertow-dev</a><br>
_______________________________________________<br>
undertow-dev mailing list<br>
<a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/undertow-dev</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
undertow-dev mailing list<br>
<a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/undertow-dev</a><br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>