users@jersey.java.net

[Jersey] Re: Catch all requests under a specific path

From: Simon Roberts <simon_at_dancingcloudphotography.com>
Date: Mon, 24 Mar 2014 21:58:47 -0600

I'm not totally sure I know what you want, but this does what I think
you're asking for:

@Path("someting/{seg: .*}")

It will match _anything_ starting with something, no matter how many more
elements come below it (because the wildcard matches / too)

You would inject this into your method arguments:

@Context UriInfo uriInfo,

and you can extract the individual segments like this:

List<PathSegment> lps = uriInfo.getPathSegments();

HTH,
Simon



> Subject: [Jersey] Re: Catch all requests under a specific path
> I'm planning to use this for testing purposes, so would be nice to capture
> all requests instead of having to add a new endpoint every time I add a new
> one to that actual code.
>
>
-- 
Simon Roberts
Certified Professional Photographer
http://dancingcloudphotography.com
(303) 249 3613