On Oct 25, 2008, at 7:49 AM, Gili wrote:
>
> 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?
>
IMHO this is a interoperability bug in Guice (or whatever it uses).
Guice should preserve annotations.
Unfortunately i cannot work around this. Jersey would not conform to
the JAX-RS specification if @Path annotations are searched up the
hierarchy. The definition of a root resource class is a class that is
annotated with @Path. Guice converts root resource classes into
resource classes.
Paul.
> 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.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>