<div dir="ltr">Thanks for the quick response. This is exactly what I was looking for.<div><br></div><div>Bill</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 class="HOEnZb"><div class="h5"><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>