[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wink-user
Subject:    Re: user application configuration
From:       Raymond Feng <enjoyjava () gmail ! com>
Date:       2011-03-23 16:11:29
Message-ID: 03E7C7C3-33A2-4200-A11F-9204A4EB83AC () gmail ! com
[Download RAW message or body]

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
> > > > 
> > > > 
> > 
> > 


[Attachment #3 (unknown)]

<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; \
-webkit-line-break: after-white-space; ">The other option is to use JAX-RS \
ContextResolver to provide custom context to your JAX-RS resource classes. For \
example,<div><br></div><div>In the resource class, use the following to inject \
env:</div><div><br></div><div>@Context&nbsp;</div><div>MyEnv \
env;</div><div><br></div><div>You can implement a ContextResolver for MyEnv type to \
create instances of MyEnv.&nbsp;</div><div><br></div><div>Thanks,</div><div>Raymond<br><div>
 <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, \
0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: \
normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; \
text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; \
widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; \
-webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; \
-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span \
class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); \
font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; \
font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; \
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: \
0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; \
-webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; \
-webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; \
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span \
class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); \
font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; \
font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; \
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: \
0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; \
-webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; \
-webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; \
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><font \
class="Apple-style-span" face="Calibri, Verdana, Helvetica, Arial" size="4"><span \
class="Apple-style-span" style="font-size: 15px; "><i><span class="Apple-style-span" \
style="font-style: normal; "><span class="Apple-style-span" style="font-family: \
Helvetica; font-size: medium; \
">________________________________________________________________&nbsp;<br><div><span \
class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); \
font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; \
font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; \
text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: \
0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; \
-webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; \
-webkit-text-stroke-width: 0px; "><span class="Apple-style-span" \
style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; \
font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; \
letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; \
text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; \
-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; \
-webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; \
-webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; \
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><font \
face="Calibri, Verdana, Helvetica, Arial"><span style="font-size: 11pt; ">Raymond \
Feng</span></font></div><div><font face="Calibri, Verdana, Helvetica, Arial"><span \
style="font-size: 11pt; "><a \
href="mailto:rfeng@apache.org">rfeng@apache.org</a><br><i>Apache Tuscany PMC member \
and committer: tuscany.apache.org<br>Co-author of Tuscany SCA In Action book: \
www.tuscanyinaction.com<br>Personal Web Site: \
www.enjoyjava.com<br></i></span></font></div></div></span></span></div>_______________ \
_________________________________________________</span></span></i></span></font></div></div></span></div></span></span>
 </div>
<br><div><div>On Mar 23, 2011, at 7:12 AM, Bryant Luk wrote:</div><br \
class="Apple-interchange-newline"><blockquote type="cite"><div>This seems more like a \
generic application configuration issue rather<br>than JAX-RS specific. Depending on \
the complexity of the application,<br>you could read a configuration file at runtime, \
load up configuration<br>from a data source (like a database) at runtime, or some \
other<br>mechanism.<br><br>You could use the JAX-RS Application class to contain the \
bootstrap<br>logic to do some setup (e.g. in your \
getClasses()/getSingletons()<br>method start reading the configuration).<br><br>On \
Wed, Mar 23, 2011 at 8:18 AM, Edoardo Comar &lt;<a \
href="mailto:ECOMAR@uk.ibm.com">ECOMAR@uk.ibm.com</a>&gt; wrote:<br><blockquote \
type="cite">Yes, sort of.<br></blockquote><blockquote \
type="cite"><br></blockquote><blockquote type="cite">I need - at runtime - to know \
which locations contain the files I may need<br></blockquote><blockquote \
type="cite">to serve,<br></blockquote><blockquote type="cite">The number and file:// \
URIs of these location may need to change from time<br></blockquote><blockquote \
type="cite">to time and I'd like my app to automatically use the latest \
values.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote \
type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote \
type="cite">Bryant Luk &lt;<a \
href="mailto:bryant.luk@gmail.com">bryant.luk@gmail.com</a>&gt; wrote on 23/03/2011 \
12:39:46:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote \
type="cite"><blockquote type="cite">From: Bryant Luk &lt;<a \
href="mailto:bryant.luk@gmail.com">bryant.luk@gmail.com</a>&gt;<br></blockquote></blockquote><blockquote \
type="cite"><blockquote type="cite">To: <a \
href="mailto:wink-user@incubator.apache.org">wink-user@incubator.apache.org</a><br></blockquote></blockquote><blockquote \
type="cite"><blockquote type="cite">Date: 23/03/2011 \
12:41<br></blockquote></blockquote><blockquote type="cite"><blockquote \
type="cite">Subject: Re: user application \
configuration<br></blockquote></blockquote><blockquote type="cite"><blockquote \
type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote \
type="cite">So are you saying while the JAX-RS application is processing \
its<br></blockquote></blockquote><blockquote type="cite"><blockquote \
type="cite">requests, is it suppose to retrieve information from other \
resource<br></blockquote></blockquote><blockquote type="cite"><blockquote \
type="cite">URLs? &nbsp;And that you want to configure those URLs that it \
retrieves<br></blockquote></blockquote><blockquote type="cite"><blockquote \
type="cite">information from?<br></blockquote></blockquote><blockquote \
type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote \
type="cite"><blockquote type="cite">On Tue, Mar 22, 2011 at 2:27 PM, Edoardo Comar \
&lt;<a href="mailto:ECOMAR@uk.ibm.com">ECOMAR@uk.ibm.com</a>&gt; \
wrote:<br></blockquote></blockquote><blockquote type="cite"><blockquote \
type="cite"><blockquote \
type="cite"><br></blockquote></blockquote></blockquote><blockquote \
type="cite"><blockquote type="cite"><blockquote \
type="cite">Hi<br></blockquote></blockquote></blockquote><blockquote \
type="cite"><blockquote type="cite"><blockquote type="cite">I just started using \
wink, I am very pleased :-)<br></blockquote></blockquote></blockquote><blockquote \
type="cite"><blockquote type="cite"><blockquote \
type="cite"><br></blockquote></blockquote></blockquote><blockquote \
type="cite"><blockquote type="cite"><blockquote type="cite">what are the best \
approaches to configure a jax-rs/wink application \
?<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote \
type="cite"><blockquote \
type="cite"><br></blockquote></blockquote></blockquote><blockquote \
type="cite"><blockquote type="cite"><blockquote type="cite">I'd need to configure a \
list of URLs where my application \
would<br></blockquote></blockquote></blockquote><blockquote \
type="cite">retrieve<br></blockquote><blockquote type="cite"><blockquote \
type="cite"><blockquote type="cite">info \
from.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote \
type="cite"><blockquote type="cite">Ideally these should be changeable after the war \
is deployed.<br></blockquote></blockquote></blockquote><blockquote \
type="cite"><blockquote type="cite"><blockquote \
type="cite"><br></blockquote></blockquote></blockquote><blockquote \
type="cite"><blockquote type="cite"><blockquote type="cite">Edoardo \
Comar<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote \
type="cite"><blockquote type="cite"><a \
href="mailto:ecomar@uk.ibm.com">ecomar@uk.ibm.com</a><br></blockquote></blockquote></blockquote><blockquote \
type="cite"><blockquote type="cite"><blockquote \
type="cite"><br></blockquote></blockquote></blockquote><blockquote \
type="cite"><blockquote type="cite"><blockquote \
type="cite"><br></blockquote></blockquote></blockquote><blockquote \
type="cite"><br></blockquote><blockquote \
type="cite"><br></blockquote></div></blockquote></div><br></div></body></html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic