public class WebApplicationExceptionMapper extends Object implements javax.ws.rs.ext.ExceptionMapper<javax.ws.rs.WebApplicationException>
WebApplicationException
.
This class interacts with FaultListener
.
If FaultListener
is available and has indicated that it handled the exception then
no more logging is done, otherwise a message is logged at WARN (default) or FINE level
which can be controlled with a printStackTrace propertyConstructor and Description |
---|
WebApplicationExceptionMapper() |
Modifier and Type | Method and Description |
---|---|
protected String |
buildErrorMessage(javax.ws.rs.core.Response r,
javax.ws.rs.WebApplicationException ex) |
void |
setAddMessageToResponse(boolean addMessageToResponse)
Controls whether to add an error message to Response or not,
|
void |
setPrintStackTrace(boolean printStackTrace)
Control whether to log at WARN or FINE level.
|
javax.ws.rs.core.Response |
toResponse(javax.ws.rs.WebApplicationException ex) |
public javax.ws.rs.core.Response toResponse(javax.ws.rs.WebApplicationException ex)
toResponse
in interface javax.ws.rs.ext.ExceptionMapper<javax.ws.rs.WebApplicationException>
protected String buildErrorMessage(javax.ws.rs.core.Response r, javax.ws.rs.WebApplicationException ex)
public void setPrintStackTrace(boolean printStackTrace)
FaultListener
has handled the exceptionprintStackTrace
- if set to true then WARN level is used (default),
otherwise - FINE level.public void setAddMessageToResponse(boolean addMessageToResponse)
addMessageToResponse
- add a message to Response, ignored
if the captuted WebApplicationException has
a Response with a non-null entityApache CXF