I did something similar to Greg by delegating to a RoutingHandler which has
a PathHandler fallback.
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(a)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(a)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(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/undertow-dev
_______________________________________________
undertow-dev mailing list
undertow-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/undertow-dev