Yes, that's fine. The role of the ServletActionContext is to make it easy to snag the request from an Action or Interceptor.
The ActionContext itself is a thread-local container of the objects being processed with the request. The core framework objects, like Locale, are defined in the XWork ActionContext. The ServletActionContext is the Struts 2 extension that hosts web-specific objects.
From an Interceptor, another way to snag the request is from the
invocation that is passed in by the framework. HttpServletRequest request = (HttpServletRequest) invocation.getInvocationContext().get(HTTP_REQUEST); But, this idiom only works in an Interceptor. The ServletActionContext approach works in an Action too. -- HTH, Ted. * http://www.husted.com/struts/ On 11/6/06, Mark Menard <[EMAIL PROTECTED]> wrote:
I need to access the HttpServletRequest from an Interceptor. I'm using: HttpServletRequest request = ServletActionContext.getRequest (); Is that the correct way to get it? It works, but I'm not sure that's how I should be doing it. Thanks,
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]