Top Description Methods
javax.ws.rs.ext

public Interface ExceptionMapper<E extends java.lang.Throwable>

Type Parameters
<E>
exception type supported by the provider.
Imports
javax.ws.rs.core.Response

Contract for a provider that maps Java exceptions to javax.ws.rs.core.Response.

Providers implementing ExceptionMapper contract must be either programmatically registered in a JAX-RS runtime or must be annotated with @Provider annotation to be automatically discovered by the JAX-RS runtime during a provider scanning phase.

Authors
Paul Sandoz, Marc Hadley
Since
1.0
See Also
Provider, javax.ws.rs.core.Response

Method Summary

Modifier and TypeMethod and Description
public Response

Returns:

a response mapped from the supplied exception.
toResponse
(E
the exception to map to a response.
exception
)

Map an exception to a javax.ws.rs.core.Response.

Method Detail

toResponseback to summary
public Response toResponse(E exception)

Map an exception to a javax.ws.rs.core.Response. Returning null results in a javax.ws.rs.core.Response.Status#NO_CONTENT response. Throwing a runtime exception results in a javax.ws.rs.core.Response.Status#INTERNAL_SERVER_ERROR response.

Parameters
exception:E

the exception to map to a response.

Returns:Response

a response mapped from the supplied exception.