Package org.apache.cxf.jaxrs.impl
Class WebApplicationExceptionMapper
- java.lang.Object
-
- org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper
-
- All Implemented Interfaces:
javax.ws.rs.ext.ExceptionMapper<javax.ws.rs.WebApplicationException>
public class WebApplicationExceptionMapper extends Object implements javax.ws.rs.ext.ExceptionMapper<javax.ws.rs.WebApplicationException>
Default exception mapper forWebApplicationException
. This class interacts withFaultListener
. IfFaultListener
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 property
-
-
Constructor Summary
Constructors Constructor Description WebApplicationExceptionMapper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
buildErrorMessage(javax.ws.rs.core.Response r, javax.ws.rs.WebApplicationException ex)
protected javax.ws.rs.core.Response
buildResponse(javax.ws.rs.core.Response response, String responseText)
protected Level
getStackTraceLogLevel(org.apache.cxf.message.Message msg, javax.ws.rs.core.Response r)
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)
-
-
-
Method Detail
-
toResponse
public javax.ws.rs.core.Response toResponse(javax.ws.rs.WebApplicationException ex)
- Specified by:
toResponse
in interfacejavax.ws.rs.ext.ExceptionMapper<javax.ws.rs.WebApplicationException>
-
getStackTraceLogLevel
protected Level getStackTraceLogLevel(org.apache.cxf.message.Message msg, javax.ws.rs.core.Response r)
-
buildErrorMessage
protected String buildErrorMessage(javax.ws.rs.core.Response r, javax.ws.rs.WebApplicationException ex)
-
buildResponse
protected javax.ws.rs.core.Response buildResponse(javax.ws.rs.core.Response response, String responseText)
-
setPrintStackTrace
public void setPrintStackTrace(boolean printStackTrace)
Control whether to log at WARN or FINE level. Note this property is ignored if a registeredFaultListener
has handled the exception- Parameters:
printStackTrace
- if set to true then WARN level is used (default), otherwise - FINE level.
-
setAddMessageToResponse
public void setAddMessageToResponse(boolean addMessageToResponse)
Controls whether to add an error message to Response or not,- Parameters:
addMessageToResponse
- add a message to Response, ignored if the captuted WebApplicationException has a Response with a non-null entity
-
-