users@jersey.java.net

[Jersey] Re: URI to a resource

From: Imran M Yousuf <imyousuf_at_smartitengineering.com>
Date: Fri, 3 Dec 2010 12:09:49 +0600

Hi Vaidya,

Its a known issue and has been fixed for 1.5 :)
http://java.net/jira/browse/JERSEY-593

Regards,

Imran

On Fri, Dec 3, 2010 at 2:14 AM, vaidya nathan <vaidyaatdst_at_gmail.com> wrote:
>
> Thank you Imran,
>
> This works without the LoggingFilter . If in introduce the LoggingFilter in
> the web.xml I get a NPE.
>
>
> 14:10:13,223 ERROR [STDERR] com.sun.jersey.api.container.ContainerException:
> java.lang.NullPointerException
> 14:10:13,223 ERROR [STDERR]     at
> com.sun.jersey.server.impl.application.WebApplicationImpl$13.matchUriInfo(WebApplicationImpl.java:784)
> 14:10:13,223 ERROR [STDERR]     at
> com.sun.jersey.server.impl.application.WebApplicationImpl$13.matchResource(WebApplicationImpl.java:789)
> 14:10:13,254 ERROR [STDERR]     at
> com.sun.jersey.server.impl.application.WebApplicationImpl$13.matchResource(WebApplicationImpl.java:794)
>
>
> My code is very simple
>
>                 uri=buildURI(typesURI);
>                 Types types=rs1.matchResource(uri,Types.class);
>
> and if i have the web.xml entry of the LoggingFilter it gives the NPE.
> Otherwise it goes through and resolves the resource..
>
>
>
> I am using jersey 1.4.. Is this a bug in jersey?
>
> Cheers
> Vaidya
>
>
>
> On Wed, Dec 1, 2010 at 8:45 PM, Imran M Yousuf
> <imyousuf_at_smartitengineering.com> wrote:
>>
>> 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
>
>



-- 
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