Class ClientRequestException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.sdase.commons.client.jersey.error.ClientRequestException
- All Implemented Interfaces:
Closeable
,Serializable
,AutoCloseable
Exception that wraps any
WebApplicationException
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:
-
Constructor Summary
-
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ClientRequestException
- Parameters:
cause
- the caughtWebApplicationException
that occurred in a Http request
-
-
Method Details
-
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
- Returns:
- the
Response
of the outgoing request if available, otherwise an emptyOptional
-
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 interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-