2

I need to handle requests that may have a number of sub path elements (that I can ignore), e.g. the following would all map to the same handler:

  • /abc?type=a
  • /abc/foo?type=a
  • /abc/foo/bar?type=a

The only code I have come up with is:

Handlers.pathTemplate().add("/{id}", handler).add("/{id}/foo", handler).add("/{id}/foo/bar", handler);

But this is not ideal as I need to define each possible path, is there anyway to allow (and ignore) any number of paths following my prefix e.g.

Handlers.pathTemplate().add("/{id}*", handler)

Handlers.path().addPrefixPath allows this sort of matching but then I would lose the path template variables.

Andy
  • 286
  • 4
  • 8

1 Answers1

0

I would like you to reference this question. Routing template format for undertow

The accepted answer clearly outlines how to preserve the path variables through Handlers.routing()

  • I can't check as I am no longer using Undertow or have access to that code but it certainly does look like it would do the job – Andy Jun 05 '18 at 13:03