On Sep 10, 2009, at 11:02 PM, dloy wrote:
> Hi Marc
> I currently create a single jar that may have multiple classes with
> Jersey annotations. Two classes may have identical @Path annotations
> but only one class would be called in a specific servlet.
>
> Example
> storage servlet calls JerseyStorage.class
> node servlet calls JerseyNode.class
>
You can experiment with the Servlet 3.0 support as Naresh indicates
but you can also explicitly refer to classes that extend from
javax.ws.rs.core.Application, or ResourceConfig, if you are more
comfortable working from stable releases.
See here:
https://jersey.dev.java.net/nonav/documentation/1.1.2-ea/user-guide.html
#d4e115
You can essentially declare two servlets referencing two different
application classes that register your root resources.
Alternatively you can explicitly declare your root resource classes
using Jersey specific package scanning (see the above link) or
explicit declare the classes, see:
https://jersey.dev.java.net/nonav/apidocs/1.1.2-ea/jersey/com/sun/jersey/api/core/ClassNamesResourceConfig.html
Paul.
> One approach is that each war would only contain one of the resource
> classes. I was hoping there was some web.xml directive to force
> Jersey to resolve its resources to a single application or possibly
> a single project. I have seen some references to ResourceConfig
> extensions on the web but I wasn't clear what was needed to get this
> to work.
>
> I hope this is helps clarify.
> Thanks
> David
>
>
> Marc Hadley wrote:
>> Can you say a little more about what you are trying to do. Jersey
>> can handle (and will normally discover) multiple resource classes
>> in a single application and will route requests to the appropriate
>> resource class according to the algorithm here:
>>
>> https://jsr311.dev.java.net/nonav/releases/1.0/spec/
>> spec3.html#x3-340003.7
>>
>> Marc.
>>
>> On Sep 10, 2009, at 3:39 PM, dloy wrote:
>>
>>> I have successfully been able to use a Jersey resource class using
>>> a web.xml containing only:
>>> <servlet-
>>> class>com.sun.jersey.spi.container.servlet.ServletContainer</
>>> servlet-class>
>>> Letting Jersey discover the resources.
>>>
>>> I now require having multiple classes that have overlapping
>>> resource @Path. What is the preferred method for directing Jersey
>>> to a specific class or project for resolving the resources.
>>>
>>> I've encountered a number of suggestions on the Web which resulted
>>> in:
>>>
>>> is not a super class of class com.sun.jersey.api.core.ResourceConfig
>>>
>>> Could someone direct me to documentation for doing this (an
>>> example would be useful if it requires class modification -
>>> extending ResourceConfig).
>>>
>>> Thanks
>>> David
>>>
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>