You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Diego Manilla Suárez <di...@xeridia.com> on 2005/05/31 11:10:17 UTC

Send a 403 response

Hi! I need to implement some kind of security inside of an Action. When 
the user doesn't meet certain criteria, I must send him to the 
"forbidden" page. Right now I'm doing this:

if (!allowed) {
    response.sendError(HttpServletResponse.SC_FORBIDDEN);
    return null;
}

The problem is that the user is sent to the default error page of 
Tomcat, instead of the 403 page defined in web.xml. Are the lines above 
wrong?

Thanks in advance.


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


Re: Send a 403 response

Posted by Diego Manilla Suárez <di...@xeridia.com>.
Diego Manilla Suárez wrote:

> Hi! I need to implement some kind of security inside of an Action. 
> When the user doesn't meet certain criteria, I must send him to the 
> "forbidden" page. Right now I'm doing this:
>
> if (!allowed) {
>    response.sendError(HttpServletResponse.SC_FORBIDDEN);
>    return null;
> }
>
> The problem is that the user is sent to the default error page of 
> Tomcat, instead of the 403 page defined in web.xml. Are the lines 
> above wrong?
>
> Thanks in advance.


Ok, I found the problem: there was a filter that wasn't forwarding the 
error.

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