Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jersey-dev] [External] : Obtaining Path template for Resource or Sub Resource at ContainerRequestFilter

Just to understand: with "List<UriTemplate> getMatchedTemplates();" I can compose the complete URI, templated for resource method?
For example if I have a resource class annotated with @Path("orders") and inside a method annotated with "{id}", then that list would contain ("order", "{id}") ?

On Sun, Mar 10, 2024 at 9:19 PM Jan Supol <jan.supol@xxxxxxxxxx> wrote:

In ContainerRequestFilter, you can use (ExtendedUriInfo) ContainerRequestContext#getUriInfo. Or you can inject it using @Context​ ExtendedUriInfo info.


--Jan



From: Asaf Mesika <asaf.mesika@xxxxxxxxx>
Sent: Sunday, March 10, 2024 11:05 AM
To: Jan Supol <jan.supol@xxxxxxxxxx>
Cc: jersey developer discussions <jersey-dev@xxxxxxxxxxx>
Subject: Re: [External] : [jersey-dev] Obtaining Path template for Resource or Sub Resource at ContainerRequestFilter
 
Yes.

Mind I ask: How can the request filter obtain ExtendedUriInfo?


On Thu, Mar 7, 2024 at 6:18 PM Jan Supol <jan.supol@xxxxxxxxxx> wrote:
HI, 
Thanks,
Jan

From: jersey-dev <jersey-dev-bounces@xxxxxxxxxxx> on behalf of Asaf Mesika via jersey-dev <jersey-dev@xxxxxxxxxxx>
Sent: Thursday, March 7, 2024 8:41 AM
To: jersey developer discussions <jersey-dev@xxxxxxxxxxx>
Cc: Asaf Mesika <asaf.mesika@xxxxxxxxx>
Subject: [External] : [jersey-dev] Obtaining Path template for Resource or Sub Resource at ContainerRequestFilter
 
Hi,

I'm trying to find a way to to obtain the full path template as defined by the JAX-RS @Path annotations, at at Jersey filter - ContainerRequestFilter.
The only work-around I found so far was to iterate backwards from Resource to Parent Resource and obtain the path from it. The starting point is UriInfo --> ResourceMethod --> Resource ...

Thanks!

Asaf

Back to the top