You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Michal Šiplák <ms...@ew.sk> on 2003/10/03 16:30:15 UTC

Problem with forward in Servlet Filter

I use tomcat 4
I try write secure servlet fitler. When I recognize that user is not
authorized I try change web resource whith RequestDispatcher. But response
is only "404 not found"

This is example of my code:

doFilter.....{

		if(userHaveRights())
		{

			String path =
((HttpServletRequest)request).getContextPath()+"/errorpages/errMessage.jsp";
			try{
				RequestDispatcher ds = this.ctx.getRequestDispatcher(cesta);
				ds.forward(request,response);
				return;
			}
			catch(Exception e){
				System.err.println("SOMETHING");
			}
		}
		else
		{
			chain.doFilter(request, response);
		}

}

Thanks for advice.

Michal


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org