Class DefaultNuxeoExceptionHandler
- java.lang.Object
-
- org.nuxeo.ecm.platform.web.common.exceptionhandling.DefaultNuxeoExceptionHandler
-
- All Implemented Interfaces:
NuxeoExceptionHandler
- Direct Known Subclasses:
SecurityExceptionHandler,ShibbolethSecurityExceptionHandler
public class DefaultNuxeoExceptionHandler extends Object implements NuxeoExceptionHandler
- Author:
- arussel
-
-
Field Summary
Fields Modifier and Type Field Description protected static com.fasterxml.jackson.databind.ObjectMapperMAPPERprotected NuxeoExceptionHandlerParametersparameters-
Fields inherited from interface org.nuxeo.ecm.platform.web.common.exceptionhandling.NuxeoExceptionHandler
EXCEPTION_HANDLER_MARKER
-
-
Constructor Summary
Constructors Constructor Description DefaultNuxeoExceptionHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringgetExceptionMessage(String message, int status)protected ErrorHandlergetHandler(Throwable t)StringgetLoginURL(javax.servlet.http.HttpServletRequest request)Gets the URL to redirect to when a login is needed for an Anonymous user.protected PrincipalgetPrincipal(javax.servlet.http.HttpServletRequest request)booleanhandleAnonymousException(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Handles the Security Error when the user is anonymous.voidhandleException(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Throwable t)voidsetParameters(NuxeoExceptionHandlerParameters parameters)protected voidstartHandlingException(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Throwable t)Puts a marker in request to avoid looping over the exception handling mechanismprotected voidwriteExceptionAsJson(javax.servlet.http.HttpServletResponse response, int status, Throwable e)
-
-
-
Field Detail
-
MAPPER
protected static final com.fasterxml.jackson.databind.ObjectMapper MAPPER
-
parameters
protected NuxeoExceptionHandlerParameters parameters
-
-
Method Detail
-
setParameters
public void setParameters(NuxeoExceptionHandlerParameters parameters)
- Specified by:
setParametersin interfaceNuxeoExceptionHandler
-
startHandlingException
protected void startHandlingException(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Throwable t) throws javax.servlet.ServletExceptionPuts a marker in request to avoid looping over the exception handling mechanism- Throws:
javax.servlet.ServletException- if request has already been marked as handled. The initial exception is then wrapped.
-
handleException
public void handleException(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Throwable t) throws IOException, javax.servlet.ServletException- Specified by:
handleExceptionin interfaceNuxeoExceptionHandler- Throws:
IOExceptionjavax.servlet.ServletException
-
handleAnonymousException
public boolean handleAnonymousException(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws IOException, javax.servlet.ServletExceptionDescription copied from interface:NuxeoExceptionHandlerHandles the Security Error when the user is anonymous.- Specified by:
handleAnonymousExceptionin interfaceNuxeoExceptionHandler- Returns:
trueif the Security Error is handled so that the calling method won't fallback on the default handler,falseotherwise.- Throws:
IOExceptionjavax.servlet.ServletException
-
getLoginURL
public String getLoginURL(javax.servlet.http.HttpServletRequest request)
Description copied from interface:NuxeoExceptionHandlerGets the URL to redirect to when a login is needed for an Anonymous user.- Specified by:
getLoginURLin interfaceNuxeoExceptionHandler
-
getHandler
protected ErrorHandler getHandler(Throwable t)
-
getPrincipal
protected Principal getPrincipal(javax.servlet.http.HttpServletRequest request)
-
writeExceptionAsJson
protected void writeExceptionAsJson(javax.servlet.http.HttpServletResponse response, int status, Throwable e) throws IOException- Throws:
IOException
-
-