users@jersey.java.net

Re: [Jersey] How to access init-param values from a Jersey web application

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 20 May 2010 15:25:10 +0200

On May 20, 2010, at 3:22 PM, Martin Giese wrote:

> On 05/20/2010 03:12 PM, Paul Sandoz wrote:
>> On May 20, 2010, at 2:29 PM, Martin Giese wrote:
>>> On 05/20/2010 02:23 PM, Edwin Shin wrote:
>>>> See my last few emails about testing with init-params and Pavel &
>>>> Paul's responses:
>>>>
>>>> https://jersey.dev.java.net/servlets/BrowseList?list=users&by=thread&from=2947919
>>>>
>>>>
>>>>
>>> I saw those (after my original post), thank you! But it seems that
>>> those inject the config into the constructor for resource objects,
>>> and
>>> not for the application object. I tried doing it for the
>>> Application
>>> object,
>>>
>>> class MyApp extends Application
>>> public MyApp(@Context ServletConfig sc) {
>>> ...
>>> }
>>> }
>>>
>>> but the application object is constructed with the no-argument
>>> constructor, so that didn't help.
>>>
>>
>> What version of Jersey are you using?
> I have
>
> jersey-core-1.0.3.jar
> jersey-server-1.0.3.jar
>
> Should I be using jersey-1.2 ?
>

Yes, you will need to switch to 1.1.4 or greater. IIRC support for
instantiating Application as a managed component was introduced in JAX-
RS 1.1.

Paul.