users@jersey.java.net

Re: [Jersey] com.sun.jersey.impl.uri.UriBuilderImpl.path() throws an unexpected exception

From: Gili <cowwoc_at_bbs.darktech.org>
Date: Fri, 24 Oct 2008 22:49:39 -0700 (PDT)

Paul, can you please read
http://groups.google.com/group/google-guice/browse_frm/thread/be6959e2f4464f04?hl=en

They are asking whether Jersey can parse the class hierarchy when looking
for @Path annotations. Would this be compatible with the JAX-RS
specification? Would it make sense to do so?

Gili


Gili wrote:
>
> I tracked this down. The problem turns out that when Guice injects
> Resources on behalf of Jersey getClass() returns class
> Foo$$EnhancerByGuice$$7605d971 whereas Jersey expects class Foo. The
> "enhanced" class has no @Path annotation.
>
> Paul, can you replace the current error message by "Class <name> must be
> annotated with the @Path annotation"? I find the current error message
> misleading, because Path is not really null.
>
> Thanks,
> Gili
>
>
> Gili wrote:
>>
>> uri is a class-field UriInfo.
>>
>> uri.getBaseUriBuilder().path(getClass()) throws the same exception.
>> uri.getPath() returns "administrators"
>>
>> Gili
>>
>>
>> Gili wrote:
>>>
>>> Hi,
>>>
>>> My code invokes:
>>>
>>> uri.getBaseUriBuilder().path(getClass(), "getAdministrator").build(name)
>>>
>>> and I get the following exception:
>>>
>>> java.lang.IllegalArgumentException: Path is null
>>> at
>>> com.sun.jersey.impl.uri.UriBuilderImpl.appendPath(UriBuilderImpl.java:391)
>>> at com.sun.jersey.impl.uri.UriBuilderImpl.path(UriBuilderImpl.java:237)
>>> at
>>> method.adcaster.network.resources.Administrators.getRelativeURI(Administrators.java:165)
>>> [snip]
>>>
>>> I don't understand why the exception is being thrown. The resource and
>>> method are not null, the method exists and it has a @Path annotation.
>>>
>>> Gili
>>>
>>
>>
>
>

-- 
View this message in context: http://n2.nabble.com/com.sun.jersey.impl.uri.UriBuilderImpl.path%28%29-throws-an-unexpected-exception-tp1373393p1374702.html
Sent from the Jersey mailing list archive at Nabble.com.