Package org.apache.cxf.jaxrs.impl
Class WebApplicationExceptionMapper
java.lang.Object
org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper
- All Implemented Interfaces:
jakarta.ws.rs.ext.ExceptionMapper<jakarta.ws.rs.WebApplicationException>
public class WebApplicationExceptionMapper
extends Object
implements jakarta.ws.rs.ext.ExceptionMapper<jakarta.ws.rs.WebApplicationException>
Default exception mapper for
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 property-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringbuildErrorMessage(jakarta.ws.rs.core.Response r, jakarta.ws.rs.WebApplicationException ex) protected jakarta.ws.rs.core.ResponsebuildResponse(jakarta.ws.rs.core.Response response, String responseText) protected LevelgetStackTraceLogLevel(Message msg, jakarta.ws.rs.core.Response r) voidsetAddMessageToResponse(boolean addMessageToResponse) Controls whether to add an error message to Response or not,voidsetPrintStackTrace(boolean printStackTrace) Control whether to log at WARN or FINE level.jakarta.ws.rs.core.ResponsetoResponse(jakarta.ws.rs.WebApplicationException ex)
-
Constructor Details
-
WebApplicationExceptionMapper
public WebApplicationExceptionMapper()
-
-
Method Details
-
toResponse
public jakarta.ws.rs.core.Response toResponse(jakarta.ws.rs.WebApplicationException ex) - Specified by:
toResponsein interfacejakarta.ws.rs.ext.ExceptionMapper<jakarta.ws.rs.WebApplicationException>
-
getStackTraceLogLevel
-
buildErrorMessage
protected String buildErrorMessage(jakarta.ws.rs.core.Response r, jakarta.ws.rs.WebApplicationException ex) -
buildResponse
protected jakarta.ws.rs.core.Response buildResponse(jakarta.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 registeredFaultListenerhas 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
-