Class AccessDeniedHandlerImpl
- java.lang.Object
-
- org.springframework.security.web.access.AccessDeniedHandlerImpl
-
- All Implemented Interfaces:
AccessDeniedHandler
public class AccessDeniedHandlerImpl extends java.lang.Object implements AccessDeniedHandler
Base implementation ofAccessDeniedHandler.This implementation sends a 403 (SC_FORBIDDEN) HTTP error code. In addition, if an
errorPageis defined, the implementation will perform a request dispatcher "forward" to the specified error page view. Being a "forward", theSecurityContextHolderwill remain populated. This is of benefit if the view (or a tag library or macro) wishes to access theSecurityContextHolder. The request scope will also be populated with the exception itself, available from the keyWebAttributes.ACCESS_DENIED_403.
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.apache.commons.logging.Loglogger
-
Constructor Summary
Constructors Constructor Description AccessDeniedHandlerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidhandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, AccessDeniedException accessDeniedException)Handles an access denied failure.voidsetErrorPage(java.lang.String errorPage)The error page to use.
-
-
-
Method Detail
-
handle
public void handle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, AccessDeniedException accessDeniedException) throws java.io.IOException, javax.servlet.ServletExceptionDescription copied from interface:AccessDeniedHandlerHandles an access denied failure.- Specified by:
handlein interfaceAccessDeniedHandler- Parameters:
request- that resulted in anAccessDeniedExceptionresponse- so that the user agent can be advised of the failureaccessDeniedException- that caused the invocation- Throws:
java.io.IOException- in the event of an IOExceptionjavax.servlet.ServletException- in the event of a ServletException
-
setErrorPage
public void setErrorPage(java.lang.String errorPage)
The error page to use. Must begin with a "/" and is interpreted relative to the current context root.- Parameters:
errorPage- the dispatcher path to display- Throws:
java.lang.IllegalArgumentException- if the argument doesn't comply with the above limitations
-
-