struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john lee <>
Subject struts 2 Intercepter ServletRequestAware
Date Thu, 23 May 2013 21:29:40 GMT
Please advise the following

for struts2, for an login action, an predefined interceptor is triggered for checking cookie
, the code is the following

for  SecurityVerifySessionIntercepter, i implement the ServletRequestAware, but get null

my question is:

for intercepter, Request object can not be implemented? if can, why i get null? 

thanks in advance


public class SecurityVerifySessionIntercepter extends AbstractInterceptor implements ServletResponseAware,
ServletRequestAware {

    protected HttpServletResponse servletResponse;
    public void setServletResponse(HttpServletResponse servletResponse)
              { this.servletResponse = servletResponse; }

    protected HttpServletRequest servletRequest;
    public void setServletRequest(HttpServletRequest servletRequest) { this.servletRequest
= servletRequest; }

public String intercept(ActionInvocation invocation) throws Exception {

       ActionContext ctx=invocation.getInvocationContext();
      Map session= ctx.getContext().getSession();
         if (servletRequest==null)
             System.out.println(" Request object is null catched");
          Cookie cookieList[]=servletRequest.getCookies();

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