I believe that what you want to do is create a constructor that takes
RequestGlobals as a parameter. Then store the value out into a final
property for access later.

private final RequestGlobals _globals;
public MyDispatcher(RequestGlobals globals) {
   _globals = globals;
}
public boolean dispatch(Request request, Response response) {
   String remoteAddr = _globals.getHttpServletRequest().getRemoteAddr();
}


Check out this documentation that discusses this pattern for service to
service dependencies.
http://tapestry.formos.com/nightly/tapestry5/tapestry-ioc/cookbook/basics.html

Josh

On Nov 12, 2007 3:17 AM, mnguyen21 <[EMAIL PROTECTED]> wrote:

>
> That didn't seem to work for me.  Is what you are using for T4 or T5?  I'm
> trying to do this in T5.
>
>
>
> mnguyen21 wrote:
> >
> > Thanks! I'll try that!
> >
> > --Michael
> >
> >
> > -----Original Message-----
> > From: Norman Franke [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, November 08, 2007 1:40 PM
> > To: Tapestry users
> > Subject: Re: getting remote IP address
> >
> > Here is what I do:
> >
> > @InjectObject("service:tapestry.globals.HttpServletRequest")
> > public abstract HttpServletRequest getRequest();
> >
> > Then:
> > getRequest().getRemoteAddr()
> >
> > That works for me.
> >
> > -Norman Franke
> > ASD, Inc.
> >
> > On Nov 8, 2007, at 4:16 PM, Nguyen, Michael wrote:
> >
> >> Yea.. Turns out the example I found in Jira was for an older version
> >> of T5 possibly T4.  so I'm still stuck. :)
> >>
> >> Thanks!
> >>
> >> -----Original Message-----
> >> From: Thiago H de Paula Figueiredo [mailto:[EMAIL PROTECTED]
> >> Sent: Thursday, November 08, 2007 11:52 AM
> >> To: Tapestry users
> >> Subject: Re: getting remote IP address
> >>
> >> On Thu, 08 Nov 2007 17:36:07 -0200, Nguyen, Michael
> >> <[EMAIL PROTECTED]> wrote:
> >>
> >>> Eclipse complains
> >>> about an undefined attribute value for the @Inject annotation.
> >>
> >> Check if you have imported the right @Inject annotation
> >> (org.apache.tapestry.ioc.annotations.Inject), as it doesn't hava
> >> attributes (at least in Tapestry 5.0.6).
> >>
> >> --
> >> Thiago H. de Paula Figueiredo
> >> Desenvolvedor, Instrutor e Consultor de Tecnologia Eteg Tecnologia da
> >> Informação Ltda.
> >> http://www.eteg.com.br
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/getting-remote-IP-address-tf4773099.html#a13703883
> Sent from the Tapestry - User mailing list archive at 
> Nabble.com<http://nabble.com/>
> .
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

Reply via email to