Top Description Inners Fields Constructors Methods
org.eclipse.jetty.ee10.servlet

public Class ErrorPageErrorHandler

extends ErrorHandler
implements ErrorPageMapper
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.ee10.servlet.ErrorHandler.ErrorPageMapper
Imports
java.util.ArrayList, .HashMap, .List, .Map, jakarta.servlet.ServletException, jakarta.servlet.http.HttpServletRequest, org.slf4j.Logger, .LoggerFactory

An ErrorHandler that maps exceptions and status codes to URIs for dispatch using the internal ERROR style of dispatch.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static enum

Field Summary

Modifier and TypeField and Description
private final List<ErrorPageErrorHandler.ErrorCodeRange>
private final Map<String, String>
private boolean
public static final String
private static final Logger
Inherited from org.eclipse.jetty.ee10.servlet.ErrorHandler:
_cacheControl_disableStacks_showMessageInTitle_showServlet_showStacksERROR_CHARSETERROR_CONTEXTERROR_PAGE

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addErrorPage(Class<? extends Throwable>
The exception
exception
,
String
The URI of the error page.
uri
)

Adds ErrorPage mapping for an exception class.

public void
addErrorPage(String
The exception
exceptionClassName
,
String
The URI of the error page.
uri
)

Adds ErrorPage mapping for an exception class.

public void
addErrorPage(int
The HTTP status code to match
code
,
String
The URI of the error page.
uri
)

Adds ErrorPage mapping for a status code.

public void
addErrorPage(int
The lowest matching status code
from
,
int
The highest matching status code
to
,
String
The URI of the error page.
uri
)

Adds ErrorPage mapping for a status code range.

public String
public Map<String, String>
public boolean
isUnwrapServletException()

Returns: True if ServletException is unwrapped for Dispatcher#ERROR_EXCEPTION

public void
setErrorPages(Map<String, String>
a map of Exception class names or error codes as a string to URI string
errorPages
)

Set a map of Exception class names or error codes as a string to URI string.

public void
setUnwrapServletException(boolean
True if ServletException should be unwrapped for Dispatcher#ERROR_EXCEPTION
unwrapServletException
)

private Throwable
unwrapServletException(Throwable
the initial exception
t
,
Class<?>
the class we found matching the error page (can be null)
matchedThrowable
)

Returns: the first non ServletException from root cause chain

Inherited from org.eclipse.jetty.ee10.servlet.ErrorHandler:
badMessageErrorerrorPageForMethodgenerateAcceptableResponsegenerateAcceptableResponsegetAcceptableWritergetCacheControlgetErrorHandlergetShowMessageInTitlehandlehandleErrorPageisShowServletisShowStackssetCacheControlsetShowMessageInTitlesetShowServletsetShowStackswritewriteErrorJsonwriteErrorPagewriteErrorPageBodywriteErrorPageHeadwriteErrorPageMessagewriteErrorPageStackswriteErrorPlain

Field Detail

_errorPageListback to summary
private final List<ErrorPageErrorHandler.ErrorCodeRange> _errorPageList
_errorPagesback to summary
private final Map<String, String> _errorPages
_unwrapServletExceptionback to summary
private boolean _unwrapServletException
GLOBAL_ERROR_PAGEback to summary
public static final String GLOBAL_ERROR_PAGE
LOGback to summary
private static final Logger LOG

Hides org.eclipse.jetty.ee10.servlet.ErrorHandler.LOG.

Constructor Detail

ErrorPageErrorHandlerback to summary
public ErrorPageErrorHandler()

Method Detail

addErrorPageback to summary
public void addErrorPage(Class<? extends Throwable> exception, String uri)

Adds ErrorPage mapping for an exception class. This method is called as a result of an exception-type element in a web.xml file or may be called directly

Parameters
exception:Class<? extends Throwable>

The exception

uri:String

The URI of the error page.

addErrorPageback to summary
public void addErrorPage(String exceptionClassName, String uri)

Adds ErrorPage mapping for an exception class. This method is called as a result of an exception-type element in a web.xml file or may be called directly

Parameters
exceptionClassName:String

The exception

uri:String

The URI of the error page.

addErrorPageback to summary
public void addErrorPage(int code, String uri)

Adds ErrorPage mapping for a status code. This method is called as a result of an error-code element in a web.xml file or may be called directly.

Parameters
code:int

The HTTP status code to match

uri:String

The URI of the error page.

addErrorPageback to summary
public void addErrorPage(int from, int to, String uri)

Adds ErrorPage mapping for a status code range. This method is not available from web.xml and must be called directly.

Parameters
from:int

The lowest matching status code

to:int

The highest matching status code

uri:String

The URI of the error page.

getErrorPageback to summary
public String getErrorPage(HttpServletRequest request)

Implements org.eclipse.jetty.ee10.servlet.ErrorHandler.ErrorPageMapper.getErrorPage.

Annotations
@Override
getErrorPagesback to summary
public Map<String, String> getErrorPages()
isUnwrapServletExceptionback to summary
public boolean isUnwrapServletException()
Returns:boolean

True if ServletException is unwrapped for Dispatcher#ERROR_EXCEPTION

setErrorPagesback to summary
public void setErrorPages(Map<String, String> errorPages)

Set a map of Exception class names or error codes as a string to URI string.

Parameters
errorPages:Map<String, String>

a map of Exception class names or error codes as a string to URI string

setUnwrapServletExceptionback to summary
public void setUnwrapServletException(boolean unwrapServletException)
Parameters
unwrapServletException:boolean

True if ServletException should be unwrapped for Dispatcher#ERROR_EXCEPTION

unwrapServletExceptionback to summary
private Throwable unwrapServletException(Throwable t, Class<?> matchedThrowable)
Parameters
t:Throwable

the initial exception

matchedThrowable:Class<?>

the class we found matching the error page (can be null)

Returns:Throwable

the first non ServletException from root cause chain

org.eclipse.jetty.ee10.servlet back to summary

private Class ErrorPageErrorHandler.ErrorCodeRange

extends Object
Class Inheritance
  • java.lang.Object
  • org.eclipse.jetty.ee10.servlet.ErrorPageErrorHandler.ErrorCodeRange

Field Summary

Modifier and TypeField and Description
private final int
private final int
private final String

Constructor Summary

AccessConstructor and Description
pack-priv
ErrorCodeRange(int from, int to, String uri)

Method Summary

Modifier and TypeMethod and Description
pack-priv String
pack-priv boolean
isInRange(int value)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

_fromback to summary
private final int _from
_toback to summary
private final int _to
_uriback to summary
private final String _uri

Constructor Detail

ErrorCodeRangeback to summary
pack-priv ErrorCodeRange(int from, int to, String uri) throws IllegalArgumentException

Method Detail

getUriback to summary
pack-priv String getUri()
isInRangeback to summary
pack-priv boolean isInRange(int value)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
org.eclipse.jetty.ee10.servlet back to summary

private final Enum ErrorPageErrorHandler.PageLookupTechnique

extends Enum<ErrorPageErrorHandler.PageLookupTechnique>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final ErrorPageErrorHandler.PageLookupTechnique
public static final ErrorPageErrorHandler.PageLookupTechnique
public static final ErrorPageErrorHandler.PageLookupTechnique

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static ErrorPageErrorHandler.PageLookupTechnique
public static ErrorPageErrorHandler.PageLookupTechnique[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

GLOBALback to summary
public static final ErrorPageErrorHandler.PageLookupTechnique GLOBAL
STATUS_CODEback to summary
public static final ErrorPageErrorHandler.PageLookupTechnique STATUS_CODE
THROWABLEback to summary
public static final ErrorPageErrorHandler.PageLookupTechnique THROWABLE

Constructor Detail

PageLookupTechniqueback to summary
private PageLookupTechnique()

Method Detail

valueOfback to summary
public static ErrorPageErrorHandler.PageLookupTechnique valueOf(String name)
valuesback to summary
public static ErrorPageErrorHandler.PageLookupTechnique[] values()