Package jakarta.ws.rs.ext
Interface ExceptionMapper<E extends Throwable>
-
- Type Parameters:
E- exception type supported by the provider.
public interface ExceptionMapper<E extends Throwable>Contract for a provider that maps Java exceptions toResponse.Providers implementing
ExceptionMappercontract must be either programmatically registered in a JAX-RS runtime or must be annotated with@Providerannotation to be automatically discovered by the JAX-RS runtime during a provider scanning phase.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ResponsetoResponse(E exception)Map an exception to aResponse.
-
-
-
Method Detail
-
toResponse
Response toResponse(E exception)
Map an exception to aResponse. Returningnullresults in aResponse.Status.NO_CONTENTresponse. Throwing a runtime exception results in aResponse.Status.INTERNAL_SERVER_ERRORresponse.- Parameters:
exception- the exception to map to a response.- Returns:
- a response mapped from the supplied exception.
-
-