users@jersey.java.net

Re: [Jersey] Jersey ignores javax.ws.rs.core.Application

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 03 Oct 2008 09:10:02 +0100

On Oct 3, 2008, at 4:47 AM, Alex Sherwin wrote:

> I could be mistaken, but I'm using the init params:
>
> <init-param>
>
> <param-name>com.sun.jersey.config.property.resourceConfigClass</
> param-name>
>
> <param-value>com.sun.jersey.api.core.PackagesResourceConfig</param-
> value>
> </init-param>

Note that it is no longer necessary to declare the above init-param
for package scanning, you can just include the one declared below.

Paul.

>
> <init-param>
> <param-name>com.sun.jersey.config.property.packages</param-name>
> <param-value>com.your.package1;com.your.package2</param-value>
> </init-param>
>

> Which tells Jersey what packages to search for annotated JAX-RS impl
> classes. I just read through the JSR tonight and I got out of it that
> classes annotated with @Path, @Resource (and a few other key
> annotations)
> will be found in this manner.
>
> I don't know how it would find them if you were not using that type of
> Servlet config, though. But, for example, in the demo apps that use
> the
> lightweight http server, when building the container one of the
> methods you
> call takes a variable (Class ...) argument that you pass in a list
> of the
> resources, providers etc you want Jersey to find.
>
>
> Alex Sherwin
> alex.sherwin_at_acadiasoft.com
>
> -----Original Message-----
> From: Gili [mailto:cowwoc_at_bbs.darktech.org]
> Sent: Thursday, October 02, 2008 11:40 PM
> To: users_at_jersey.dev.java.net
> Subject: Re: [Jersey] Jersey ignores javax.ws.rs.core.Application
>
>
> I'm curious... how does the current Jersey implementation
> automatically
> locate all classes annotated with @Provider? Last I checked it
> wasn't easy
> to do that sort of thing (finding all classes in the classpath or
> module).
>
> Gili
>
>
> Paul Sandoz wrote:
>>
>> Hi Gili,
>>
>> Section 2.3.2 of JSR-311 states:
>>
>> When using a JAX-RS aware servlet container, the servlet-class
>> element of the web.xml descriptor
>> SHOULD name the application-supplied subclass of Application.
>>
>> What is written in the article is not specified by JSR-311 and is
>> non-
>> standard behaviour.
>>
>> However, Jersey does not currently support what is specified above
>> because we need to make modifications to the Servlet implementation.
>>
>> Paul.
>>
>> On Sep 29, 2008, at 9:31 PM, Gili wrote:
>>
>>>
>>> Hi,
>>>
>>> I fired up Netbeans 6.5, created a RESTful web service and added the
>>> following to my web.xml:
>>>
>>> <context-param>
>>> <param-name>javax.ws.rs.core.Application</param-name>
>>> <param-value>method.adcaster.network.Application</param-value>
>>> </context-param>
>>>
>>> According to http://architects.dzone.com/articles/putting-java-rest
>>> JAX-RS
>>> should use this class to detect all my services, but Jersey seems to
>>> ignore
>>> it and parses *all* classes instead.
>>>
>>> Did I miss something?
>>>
>>> Thank you,
>>> Gili
>>> --
>>> View this message in context:
>>>
> http://n2.nabble.com/Jersey-ignores-javax.ws.rs.core.Application-tp1127216p1
> 127216.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
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
>> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>>
>>
>>
>
> --
> View this message in context:
> http://n2.nabble.com/Jersey-ignores-javax.ws.rs.core.Application-tp1127216p1
> 140761.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
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>