You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by GF <ga...@gmail.com> on 2008/03/17 10:06:27 UTC

[S2] accessing #application and #request from a Interceptor

I have some data stored in #application.mymap
Inside and interceptor I want to put some of this data in
#request.anothermap

How can I access them?
About the #request,  is it right to do this?

        final ActionContext context = invocation.getInvocationContext();
        request = (HttpServletRequest) context.get(HTTP_REQUEST);
        request.setAttribute("anothermap", anotherMap);

Re: [S2] accessing #application and #request from a Interceptor

Posted by Nils-Helge Garli Hegvik <ni...@gmail.com>.
Have you tried context.getApplication()?

BTW: The source code for the ServletConfigInterceptor shows how to
access most of the context objects from an interceptor.

Nils-H

On Mon, Mar 17, 2008 at 10:16 AM, GF <ga...@gmail.com> wrote:
>
> On Mon, Mar 17, 2008 at 10:06 AM, GF <ga...@gmail.com> wrote:
>
>  > I have some data stored in #application.mymap
>  > Inside and interceptor I want to put some of this data in
>  > #request.anothermap
>  >
>  > How can I access them?
>  > About the #request,  is it right to do this?
>  >
>  >         final ActionContext context = invocation.getInvocationContext();
>  >         request = (HttpServletRequest) context.get(HTTP_REQUEST);
>  >         request.setAttribute("anothermap", anotherMap);
>  >
>  >
>  > Ok, I have found this is right.
>  I'm still searching how to access #application map from the Interceptor..
>

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


Re: [S2] accessing #application and #request from a Interceptor

Posted by GF <ga...@gmail.com>.
On Mon, Mar 17, 2008 at 10:06 AM, GF <ga...@gmail.com> wrote:

> I have some data stored in #application.mymap
> Inside and interceptor I want to put some of this data in
> #request.anothermap
>
> How can I access them?
> About the #request,  is it right to do this?
>
>         final ActionContext context = invocation.getInvocationContext();
>         request = (HttpServletRequest) context.get(HTTP_REQUEST);
>         request.setAttribute("anothermap", anotherMap);
>
>
> Ok, I have found this is right.
I'm still searching how to access #application map from the Interceptor..