@Provider public class JaxRsExceptionMapper extends AbstractExceptionMapper<JaxRsExceptionMapper> implements javax.ws.rs.ext.ExceptionMapper<Throwable>
ExceptionMapper
mechanic.
This handler catches all Throwable
s, logs them on the server side, and fills the response with the status
code and error description. To change/override this behavior either use the methods defined in the
AbstractExceptionMapper
, or write a custom ExceptionMapper
with the Provider
higher then the
default one.
Note that CloudLoggerFactory
is not used here to avoid recursion.
Constructor and Description |
---|
JaxRsExceptionMapper()
Default constructor, adding the handling of additional JAX-RS
Exception s. |
Modifier and Type | Method and Description |
---|---|
protected JaxRsExceptionMapper |
self()
Getter for
this . |
javax.ws.rs.core.Response |
toResponse(Throwable exception) |
getErrorResponseBuilder, logAsError, logAsInfo, logAsLevel, logAsWarning, removeMapping, toResponseWithErrorCode, withMapper, withMapper
public JaxRsExceptionMapper()
Exception
s.public javax.ws.rs.core.Response toResponse(Throwable exception)
toResponse
in interface javax.ws.rs.ext.ExceptionMapper<Throwable>
@Nonnull protected JaxRsExceptionMapper self()
AbstractExceptionMapper
this
. Needed to facilitate a fluent interface in the implementing classes.self
in class AbstractExceptionMapper<JaxRsExceptionMapper>
Copyright © 2019 SAP SE. All rights reserved.