struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <davelnew...@gmail.com>
Subject Re: struts2 Intercepter Actioncontext
Date Fri, 24 May 2013 19:46:03 GMT
It's a static class.

You may want to brush up on some Java and framework basics before
proceeding too much further-it'll save some time in the long run.

Also note that it's often faster to just try something.

Dave
 On May 24, 2013 3:17 PM, "john lee" <sh_thorn_bird@yahoo.com> wrote:

>
>
> In an cutomized Struts2 Intercepter class,
>
>     public class SecurityVerifySessionIntercepter extends
> AbstractInterceptor
>           ActionContext actionContext = invocation.getInvocationContext();
>           HttpServletRequest request= (HttpServletRequest)
> actionContext.get(StrutsStatics.HTTP_REQUEST);
>           Map session = actionContext.getSession();
>
> the above program works without any problem
>
> however,
>
>    if i want to access WebApplicationContext, i have to get
> ServletActionContext first as the following
>          WebApplicationContext
> context=WebApplicationContextUtils.getRequiredWebApplicationContext(ServletActionContext.getServletContext());
>    the compile complain can not find ServletActionContext.
>
>    for the regular Struts2 action class extends ActionSupport, then i have
> no problem to get ServletActionContext, but failed in Intercepter.
>
> Question is:
>
>     I already extends AbstractInterceptor for use interceptor, certainly i
> can not extends ActionSupport any more.
>     then how can i access ServletActionContext in the interceptor?
>     without extends Actionsupport, can i get ServletActionContext from
> ActionContext? how to convert?
>
> please advise
>
> john

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message