[undertow-dev] Docs for templates

Bill O'Neil bill at dartalley.com
Wed Sep 7 09:20:19 EDT 2016


I did something similar to Greg by delegating to a RoutingHandler which has
a PathHandler fallback.

https://gist.github.com/billoneil/08b1648a3b2a849e02c57e133bd6d45c

This allows me to add prefix routes but still not flexible enough for all
uses cases. The main drawback with this approach is the prefix handler
doesn't route based on Verb but it has worked for all of my use cases so
far.

I would also like to know if there is a way the RoutingHandler can be
extended to have wildcard functionality.

On Wed, Sep 7, 2016 at 8:08 AM, Greg Hellings <greg.hellings at gmail.com>
wrote:

> Oliver,
>
> I found it very difficult to work with the PathTemplateHandler and its
> set of matching operations seemed very minimal to me. I also found no
> efficient way to mix-and-match between full Paths and PathTemplate
> entries. So I created my own handler class that gave the ability to
> match based on both HTTP Verb and various path components.
>
> https://github.com/greg-hellings/gully/blob/master/
> src/main/java/com/thehellings/gully/Router.java
> https://github.com/greg-hellings/gully/blob/master/
> src/main/java/com/thehellings/gully/PlainRouter.java
>
> I haven't used it extensively, but in my own local testing it seems to
> work exactly the way I wanted - it's still just an HttpHandler
> underneath, so it can be placed anywhere in a handler chain. And it
> operates on the result of getRelativePath, so you can nest them within
> each other, or place them within other components in a handler chain
> and the class should operate properly.
>
> The whole set of handler and its dependent classes should be available
> as a Maven artifact if you want to play with it. If this sort of
> functionality exists somewhere in core Undertow, I've been entirely
> unable to decipher it and locate its functioning.
>
> --Greg
>
> On Tue, Sep 6, 2016 at 9:41 PM, Oliver Dain <oliver at analyticspot.com>
> wrote:
> > Hey all,
> >
> > I haven't seen any documentation on the format of a template accepted by
> a
> > PathTemplateHandler. I know the basics: "/foo", "/foo/{userId}", etc. but
> > are wildcards allowed? Is there a way to specify a handler for anything
> with
> > a certain prefix? If two handlers would match how is the tie broken, etc.
> >
> > Thanks,
> > Oliver
> > --
> > CTO, Analytic Spot
> > 44 West Broadway #222
> > Eugene, OR 97401
> > analyticspot.com • 425-296-6556
> > www.linkedin.com/in/oliverdain
> >
> > _______________________________________________
> > undertow-dev mailing list
> > undertow-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/undertow-dev
>
> _______________________________________________
> undertow-dev mailing list
> undertow-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/undertow-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20160907/ce13aa22/attachment.html 


More information about the undertow-dev mailing list