T - A type of the exception processed by the exception mapper.@Singleton public abstract class AbstractErrorTemplateMapper<T extends Throwable> extends Object implements ExtendedExceptionMapper<T>
ExtendedExceptionMapper used to declare special handling for exception types that should be
processed by MVC.
Extensions should override getErrorStatus(Throwable) and getErrorModel(Throwable) to provide a response
status and model derived from a raised throwable.
By default every exception is mapped and used as a model in a viewable and passed to the MVC runtime for
further processing.| Constructor and Description |
|---|
AbstractErrorTemplateMapper() |
| Modifier and Type | Method and Description |
|---|---|
protected Object |
getErrorModel(T throwable)
Get a model for error template.
|
protected Response.Status |
getErrorStatus(T throwable)
Get a response status of to-be-processed error template.
|
boolean |
isMappable(T throwable) |
Response |
toResponse(T throwable) |
public final boolean isMappable(T throwable)
isMappable in interface ExtendedExceptionMapper<T extends Throwable>public final Response toResponse(T throwable)
toResponse in interface ExceptionMapper<T extends Throwable>protected Object getErrorModel(T throwable)
throwable itself.throwable - throwable raised during processing a resource method.protected Response.Status getErrorStatus(T throwable)
Response.Status#OK.throwable - throwable raised during processing a resource method.Copyright © 2007-2024, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.