users@jersey.java.net

[Jersey] Re: How to know the url

From: Farrukh Najmi <farrukh_at_wellfleetsoftware.com>
Date: Mon, 14 Nov 2011 22:12:18 -0500

See the following:

javax.ws.rs.core.*UriInfo*
<http://download.oracle.com/javaee/6/api/javax/ws/rs/core/UriInfo.html>
javax.ws.rs.core.*Context*
<http://download.oracle.com/javaee/6/api/javax/ws/rs/core/Context.html>

You can use an annotated member like the following in your resource class:

     @Context
     javax.ws.rs.core.UriInfo uriInfo;


Then later use UriInfo methods to get at various component of the url.

On 11/14/2011 03:28 PM, Blaise Gervais wrote:
> Hi everyone,
>
> I have a custom MessageBodyWriter from which I would like to know the
> url used to
>
> access the resource to render. But I don't know how to achieve that.
>
> Is there a way to know the URL used to access a resource ?
>
> Thanks


-- 
Regards,
Farrukh Najmi
Web: http://www.wellfleetsoftware.com