You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Kit Yeung <wa...@outblaze.com> on 2009/01/08 10:24:56 UTC

T5: Get remote IP address without Request/GlobalRequest?

Hi all,

I have some utilities classes (that is not in Page nor Component so I can't @Inject 
request) and I want to get remote IP from those classes, is there any way to get IP 
address directly without passing the request/globalrequest object from the 
Page/Component?

Thanks

Kit

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


Re: T5: Get remote IP address without Request/GlobalRequest?

Posted by Francois Armand <fa...@linagora.com>.
Kit Yeung wrote:
> Hi all,
>
> I have some utilities classes (that is not in Page nor Component so I 
> can't @Inject request) and I want to get remote IP from those classes, 
> is there any way to get IP address directly without passing the 
> request/globalrequest object from the Page/Component?
>
In fact, this problem is hard. As soon as you put a proxy in the middle 
of the stack, you don't get what you want.

On the other hand, if you are in simple case and want to use the 
information provided by the HttpServletRequest, you will (obviously) 
have to get a access to that object. And it has to be a per request 
access to of any usefulness. If you can't access the request, perhaps 
you should ask yourself if you utility object is at good level, and as 
the rigth rigths. Wouldn't it be a perthread service ?

Perhaps can you give us some more description about what you want to 
achieve.

-- 
Francois Armand
Etudes & Développements J2EE
Groupe Linagora - http://www.linagora.com
Tél.: +33 (0)1 58 18 68 28
-----------
http://fanf42.blogspot.com
InterLDAP - http://interldap.org 
FederID - http://www.federid.org/
Open Source identities management and federation


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