You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Thiago H de Paula Figueiredo <th...@gmail.com> on 2007/11/08 20:52:18 UTC

Re: getting remote IP address

On Thu, 08 Nov 2007 17:36:07 -0200, Nguyen, Michael  
<Mi...@wolterskluwer.com> 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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: getting remote IP address

Posted by Josh Canfield <jo...@thedailytube.com>.
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 <mi...@wolterskluwer.com> 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:norman@myasd.com]
> > 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:thiagohp@gmail.com]
> >> 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
> >> <Mi...@wolterskluwer.com> 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: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> >
>
> --
> 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: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


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

Re: getting remote IP address

Posted by Norman Franke <no...@myasd.com>.
Ah, I'm in T4. It does work there.

-Norman

On Nov 12, 2007, at 6:17 AM, mnguyen21 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:norman@myasd.com]
>> 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:thiagohp@gmail.com]
>>> 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
>>> <Mi...@wolterskluwer.com> 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: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>> -------------------------------------------------------------------- 
>>> -
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
> -- 
> 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.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: getting remote IP address

Posted by mnguyen21 <mi...@wolterskluwer.com>.
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:norman@myasd.com] 
> 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:thiagohp@gmail.com]
>> 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 
>> <Mi...@wolterskluwer.com> 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: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

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


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: getting remote IP address

Posted by "Nguyen, Michael" <Mi...@wolterskluwer.com>.
Thanks! I'll try that!

--Michael
 

-----Original Message-----
From: Norman Franke [mailto:norman@myasd.com] 
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:thiagohp@gmail.com]
> 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 
> <Mi...@wolterskluwer.com> 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: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: getting remote IP address

Posted by Norman Franke <no...@myasd.com>.
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:thiagohp@gmail.com]
> 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  
> <Mi...@wolterskluwer.com> 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: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


RE: getting remote IP address

Posted by "Nguyen, Michael" <Mi...@wolterskluwer.com>.
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:thiagohp@gmail.com] 
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 <Mi...@wolterskluwer.com> 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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org