The other option is to use JAX-RS ContextResolver to provide custom context to your JAX-RS
resource classes. For example,
In the resource class, use the following to inject env:
@Context
MyEnv env;
You can implement a ContextResolver for MyEnv type to create instances of MyEnv.
Thanks,
Raymond
________________________________________________________________
Raymond Feng
rfeng@apache.org
Apache Tuscany PMC member and committer: tuscany.apache.org
Co-author of Tuscany SCA In Action book: www.tuscanyinaction.com
Personal Web Site: www.enjoyjava.com
________________________________________________________________
On Mar 23, 2011, at 7:12 AM, Bryant Luk wrote:
> This seems more like a generic application configuration issue rather
> than JAX-RS specific. Depending on the complexity of the application,
> you could read a configuration file at runtime, load up configuration
> from a data source (like a database) at runtime, or some other
> mechanism.
>
> You could use the JAX-RS Application class to contain the bootstrap
> logic to do some setup (e.g. in your getClasses()/getSingletons()
> method start reading the configuration).
>
> On Wed, Mar 23, 2011 at 8:18 AM, Edoardo Comar <ECOMAR@uk.ibm.com> wrote:
>> Yes, sort of.
>>
>> I need - at runtime - to know which locations contain the files I may need
>> to serve,
>> The number and file:// URIs of these location may need to change from time
>> to time and I'd like my app to automatically use the latest values.
>>
>>
>>
>> Bryant Luk <bryant.luk@gmail.com> wrote on 23/03/2011 12:39:46:
>>
>>> From: Bryant Luk <bryant.luk@gmail.com>
>>> To: wink-user@incubator.apache.org
>>> Date: 23/03/2011 12:41
>>> Subject: Re: user application configuration
>>>
>>> So are you saying while the JAX-RS application is processing its
>>> requests, is it suppose to retrieve information from other resource
>>> URLs? And that you want to configure those URLs that it retrieves
>>> information from?
>>>
>>> On Tue, Mar 22, 2011 at 2:27 PM, Edoardo Comar <ECOMAR@uk.ibm.com> wrote:
>>>>
>>>> Hi
>>>> I just started using wink, I am very pleased :-)
>>>>
>>>> what are the best approaches to configure a jax-rs/wink application ?
>>>>
>>>> I'd need to configure a list of URLs where my application would
>> retrieve
>>>> info from.
>>>> Ideally these should be changeable after the war is deployed.
>>>>
>>>> Edoardo Comar
>>>> ecomar@uk.ibm.com
>>>>
>>>>
>>
>>
|