On 05/20/2010 02:22 PM, Paul Sandoz wrote:
>
> On May 20, 2010, at 1:57 PM, Martin Giese wrote:
>
>> Hi,
>>
>> I have a nice litte web app with a main Application class (in fact, it
>> extends PackagesResourceConfig) and a few root resources.
>>
>> Now I have put some configuration information into web.xml in
>> <init-param> elements. It seems that I need a ServletContext or
>> ServletConfig to get at the initialization parameters. I know I can use
>> @Context to inject these into the root resource classes, but that means
>> I get the values when a request is processed. I would like to get them
>> at initialization, i.e. in the constructor of the Application class. Is
>> that possible?
>>
>
> Yes, it should be possible to do the following:
>
> public MyApp extends Application {
> @Context ServletConfig sc;
> }
I tried that. When I read sc in the constructor, it's null.
Martin