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
|