Search code examples
javajersey

Extract path params from container request


I am trying to implement ContainerRequestFilter and the method filter.

How can I extract he path params from ContainerRequest request?

I can only see a direct method to extract the query and form parameters.


Solution

  • ContainerRequest doesn't seem to contain that information, but you can inject a UriInfo into the filter and use that. See UriInfo.getPathParameters().

    Reference: How to get the value of a PathParam outside a Resource class