struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <newton.d...@yahoo.com>
Subject Re: Login checking before processing any action/class
Date Mon, 05 Nov 2007 20:26:51 GMT
Interceptor or Acegi.

d.

--- Emi Lu <emilu@encs.concordia.ca> wrote:

> Hello ,
> 
> For struts1, we use "doFilter"
> 
>      public void doFilter(
>         ServletRequest req,
>         ServletResponse res,
>         FilterChain chain)
>      throws IOException, ServletException
>      {
> 
>          HttpServletRequest request =
> (HttpServletRequest) req;
>          HttpServletResponse response =
> (HttpServletResponse) res;
>          HttpSession session = request.getSession();
> 
> 
>          If not login successfully:
> 
>          ActionConfig action = ...
>          this.sendRedirect(request, response,
> action.getPath());
> 
> 
>          else {
>              chain.doFilter(req,res);
>          }
> 
>      }
> 
> in web.xml, all classes/actions need be filtered by
> this actionClass.
> 
> For struts2, do you have a good example for login
> checking? Moreover, 
> before each action/class is called, a login checking
> will be done 
> automatically. If user logins successfully, allow
> user action to be 
> processed; otherwise, return error msg to default
> login page.
> 
> Thank you!
> 
> -e
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org
> 
> 


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


Mime
View raw message