Class ClientRequestException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- org.sdase.commons.client.jersey.error.ClientRequestException
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Serializable
,java.lang.AutoCloseable
public class ClientRequestException extends java.lang.RuntimeException implements java.io.Closeable
Exception that wraps anyWebApplicationException
that occurred in a Http request to avoid that it is used to delegate the same response to the own caller by default exception mappers.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ClientRequestException(java.lang.Throwable cause)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
This implementation can be called multiple times and will never throw an exception.java.util.Optional<javax.ws.rs.core.Response>
getResponse()
java.util.Optional<javax.ws.rs.WebApplicationException>
getWebApplicationExceptionCause()
boolean
isClientError()
boolean
isConnectTimeout()
boolean
isProcessingError()
boolean
isReadTimeout()
boolean
isServerError()
boolean
isTimeout()
-
-
-
Method Detail
-
isClientError
public boolean isClientError()
- Returns:
- if the response returned with a 4xx client error status code
-
isServerError
public boolean isServerError()
- Returns:
- if the response returned with a 5xx server error status code
-
isConnectTimeout
public boolean isConnectTimeout()
- Returns:
- if the request timed out while establishing a connection
-
isReadTimeout
public boolean isReadTimeout()
- Returns:
- if the request timed out while reading from an established connection
-
isTimeout
public boolean isTimeout()
- Returns:
- if the request timed out while establishing a connection or while reading from an established connection
-
isProcessingError
public boolean isProcessingError()
- Returns:
- if the request processing failed. This error usually occurs if the response body could not be converted to the desired response entity
-
getResponse
public java.util.Optional<javax.ws.rs.core.Response> getResponse()
- Returns:
- the
Response
of the outgoing request if available, otherwise an emptyOptional
-
getWebApplicationExceptionCause
public java.util.Optional<javax.ws.rs.WebApplicationException> getWebApplicationExceptionCause()
- Returns:
- the
Throwable.getCause()
if it is aWebApplicationException
, otherwise an emptyOptional
-
close
public void close()
This implementation can be called multiple times and will never throw an exception.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
-