Top Description Fields Methods
org.eclipse.microprofile.rest.client.ext

public Interface ResponseExceptionMapper<T extends Throwable>

Imports
java.util.Optional, jakarta.annotation.Priority, jakarta.ws.rs.Priorities, jakarta.ws.rs.core.MultivaluedMap, .Response

Converts an Jakarta RESTful Web Services Response object into an Exception.

Field Summary

Modifier and TypeField and Description
public static final int

Method Summary

Modifier and TypeMethod and Description
public default int

Returns:

the priority of this mapper
getPriority
()

The priority of this mapper.

public default boolean

Returns:

whether or not this mapper can convert the Response to a Throwable
handles
(int
the response status code indicating the HTTP response
status
,
MultivaluedMap<String, Object>
the headers from the HTTP response
headers
)

Whether or not this mapper will be used for the given response.

public T

Returns:

A throwable, if this mapper could convert the response.
toThrowable
(Response
the Jakarta RESTful Web Services response processed from the underlying client
response
)

Converts a given Response into a Throwable.

Field Detail

DEFAULT_PRIORITYback to summary
public static final int DEFAULT_PRIORITY

Method Detail

getPriorityback to summary
public default int getPriority()

The priority of this mapper. By default, it will use the Priority annotation's value as the priority. If no annotation is present, it uses a default priority of Priorities#USER.

Returns:int

the priority of this mapper

handlesback to summary
public default boolean handles(int status, MultivaluedMap<String, Object> headers)

Whether or not this mapper will be used for the given response. By default, any response code of 400 or higher will be handled. Individual mappers may override this method if they want to more narrowly focus on certain response codes or headers.

Parameters
status:int

the response status code indicating the HTTP response

headers:MultivaluedMap<String, Object>

the headers from the HTTP response

Returns:boolean

whether or not this mapper can convert the Response to a Throwable

toThrowableback to summary
public T toThrowable(Response response)

Converts a given Response into a Throwable. The runtime will throw this if it is non-null AND if it is possible to throw given the client method's signature. If this method reads the response body as a stream it must ensure that it resets the stream.

Parameters
response:Response

the Jakarta RESTful Web Services response processed from the underlying client

Returns:T

A throwable, if this mapper could convert the response.