users@jersey.java.net

Re: URI to a resource

From: Imran M Yousuf <imyousuf_at_smartitengineering.com>
Date: Thu, 2 Dec 2010 08:45:20 +0600

Hi Vadiya,

I think you are looking for -
http://jersey.java.net/nonav/apidocs/latest/jersey/com/sun/jersey/api/core/ResourceContext.html

Inject it using @Context into your resource and use it :).

Regards,

Imran

On Thu, Dec 2, 2010 at 5:45 AM, vaidya nathan <vaidyaatdst_at_gmail.com> wrote:
> Ive seen this question posted in the group some time ago but not sure what
> the solution was , so please bear with me if its a repetition.
>
> I need to convert a URI to a resource. This is probably something that is
> within the jersey engine somewhere but is this exposed to the developers?.I
> am using jersey 1.4 .  The client in my case would send two uris and i need
> to convert them into their resources and use them from within another jersey
> method.
>
> Programmatically speaking -
>
> @Path("ping")
> @XmlRootElement(name="ping")
> public class Ping  {
>
>
>     public Ping() {}
>
>    @POST
>     @Consumes({MediaType.WILDCARD})
>     @Produces({MediaType.TEXT_PLAIN})
>     public Response getDiffBetweenTwoQueryParams(@QueryParam("queryURL1")
> String queryURL1,_at_QueryParam("queryURL2") String queryURL2) {
>
>    << Concrete Resource>> resolvedResource= (Some Jersey API that i need)
> queryURL1;
> << Concrete Resource>> resolvedResource1= (Some Jersey API that i need)
> queryURL2;
>
>    // use resolvedResource and resolvedResource1 and call some methods on it
> .. I would wish that these are just POJO calls
>
>     return Response;
>
>     }
> }
>
> Cheers'
> Vaidya
>



-- 
Imran M Yousuf
Entrepreneur & CEO
Smart IT Engineering Ltd.
25/5B, Block F, Haji Chinu Miah Road Bylane
Joint Quarter, Mohammadpur
Dhaka - 1207, Bangladesh
Email: imran_at_smartitengineering.com
Twitter: @imyousuf - http://twitter.com/imyousuf
Blog: http://imyousuf-tech.blogs.smartitengineering.com/
Mobile: +880-1711402557