users@jersey.java.net

[Jersey] Re: UriInfo injection at resource initialization time

From: Martin Matula <martin.matula_at_oracle.com>
Date: Wed, 09 Mar 2011 14:09:35 +0100

In an earlier message you said: "I had implemented the same
functionality with a simple HttpServlet, so I'm still not sure if the
transition to JAX-RS is worth the trouble."
How did you do it with HttpServlet?
Martin

On 9.3.2011 12:41, Martynas Jusevicius wrote:
>> It is simple - you can't get request-specifc info outside of the request
>> context. Not sure what's confusing about it. UriInfo includes specific URI
>> that was used to make a particular request - as you know, resources can be
>> parameterized, so the URI is not always known at the deploy time.
>>
>> Anyway, seems what you are looking for is not request specific - you are
>> just trying to obtain that info in a request specific way. So, all you need
>> is doing it in a different way which is not request specific - see my other
>> e-mail...
>> Martin
>>
>>
> Ok, so maybe I mistook UriInfo as giving info about resources rather
> than requests.
>
> Regarding your other email - any ways to retrieve absolute URI
> (including base) from UriBuilder?
>
> Thanks,
>
> Martynas