Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

SEC-996: AccessDeniedhandlerimpl doesn't write response code if used with errorPage #1247

spring-issuemaster opened this Issue Sep 30, 2008 · 2 comments


None yet
1 participant

Luke Taylor(Migrated from SEC-996) said:

The forward to the error page will cause the response to be committed and thus the 403 error code cannot be written (the commit check was introduced as a fix for SEC-324), but the code should perhaps be written before the forward instead.

Mario Ceste, Jr. said:

Below is a code-snippet that will set the status code even if we’re forwarding to the error page. If the error page is not present then we’ll send an error like in the previous version. Personally, I don’t think anything can be done if the response has already been committed. We’ll assume that a previous filter has already handled the problem.

if (!response.isCommitted()) {
if (errorPage != null) {

// the status code.
HttpServletResponse resp = (HttpServletResponse) response;

// forward to error page. RequestDispatcher dispatcher = request.getRequestDispatcher(errorPage); dispatcher.forward(request, response);

} else {
HttpServletResponse resp = (HttpServletResponse) response;
resp.sendError(HttpServletResponse.SC_FORBIDDEN, exception.getMessage());


Luke Taylor said:

Thanks for the patch. I’ve applied your changes. It makes sense since you can’t forward if the resonse is committed. I wouldn’t have thought that a forward would necessarily cause a commit though, unless you have a small output buffer (or a large error page :) ).

@spring-issuemaster spring-issuemaster added this to the 3.0.0 M1 milestone Feb 5, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment