Setting the value into the action is both cleaner, and more
expressive, and unless you inject a utility class instance, easier to
test.

On Wednesday, October 27, 2010, Li Ying <liying.cn.2...@gmail.com> wrote:
> I would implement this function as a Utility Class,
> and call it from the Action class.
>
> In the Utility Class you can get the HttpServletRequest instance by
> [ServletActionContext.getRequest()].
>
> In this case, you even don't need RequestHeaderInterceptor to inject
> Headers into your action, because the Utility Class will do all the
> job.
>
>
> 2010/10/27 Jose Luis Martinez Avial <jlmarti...@pb-santander.com>:
>> Well, that's an option. Another thing I would need to get is the Remote 
>> Address. That can be complicated, since sometimes -specially when you are 
>> behind a proxy, or something like that- the IP address you get is not 
>> correct. In those cases with a proxy usually the IP is in a header in the 
>> request(For example, if you are using Apache, you will get a 
>> "x-forwarded-for" header in the request). I was thinking about doing an 
>> interceptor that can be setup to look for that header(Or one similar, that 
>> can be setup in the struts xml) and if it's not present, set the IP into the 
>> action. What do you think?
>>
>> Jose
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to