public class AccessDeniedHandlerImpl extends java.lang.Object implements AccessDeniedHandler
AccessDeniedHandler.This implementation sends a 403 (SC_FORBIDDEN) HTTP error
code. In addition, if a errorPage is defined, the implementation will perform a request dispatcher
"forward" to the specified error page view. Being a "forward", the SecurityContextHolder will remain
populated. This is of benefit if the view (or a tag library or macro) wishes to access the
SecurityContextHolder. The request scope will also be populated with the exception itself, available
from the key SPRING_SECURITY_ACCESS_DENIED_EXCEPTION_KEY.
| Modifier and Type | Field and Description |
|---|---|
protected static org.apache.commons.logging.Log |
logger |
static java.lang.String |
SPRING_SECURITY_ACCESS_DENIED_EXCEPTION_KEY |
| Constructor and Description |
|---|
AccessDeniedHandlerImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
handle(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
AccessDeniedException accessDeniedException)
Handles an access denied failure.
|
void |
setErrorPage(java.lang.String errorPage)
The error page to use.
|
public static final java.lang.String SPRING_SECURITY_ACCESS_DENIED_EXCEPTION_KEY
protected static final org.apache.commons.logging.Log logger
public void handle(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
AccessDeniedException accessDeniedException)
throws java.io.IOException,
javax.servlet.ServletException
AccessDeniedHandlerhandle in interface AccessDeniedHandlerrequest - that resulted in an AccessDeniedExceptionresponse - so that the user agent can be advised of the failureaccessDeniedException - that caused the invocationjava.io.IOException - in the event of an IOExceptionjavax.servlet.ServletException - in the event of a ServletExceptionpublic void setErrorPage(java.lang.String errorPage)
errorPage - the dispatcher path to displayjava.lang.IllegalArgumentException - if the argument doesn't comply with the above limitations