Package org.apache.juneau.rest.client
Class TransportException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.io.IOException
org.apache.juneau.rest.client.TransportException
- All Implemented Interfaces:
Serializable
Thrown by
HttpTransport.execute(TransportRequest) when a network-level error occurs (e.g. connection
refused, timeout, SSL handshake failure).
This exception wraps the underlying transport library's exception so that callers do not need to handle
Apache HttpClient, OkHttp, or JDK HttpClient exceptions directly.
- Since:
- 9.2.1
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTransportException(String message) Constructor.TransportException(String message, Throwable cause) Constructor.TransportException(Throwable cause) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanReturnstrue if the given throwable (or any cause in its chain) is the signature of a pre-response stale pooled-connection failure — the server tore down a kept-alive connection before sending any response bytes.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
TransportException
Constructor.- Parameters:
message- The error message.
-
TransportException
Constructor.- Parameters:
message- The error message.cause- The underlying cause. Can benull (no cause is chained).
-
TransportException
Constructor.- Parameters:
cause- The underlying cause. Can benull (no cause is chained).
-
-
Method Details
-
isStaleConnectionFailure
Returnstrue if the given throwable (or any cause in its chain) is the signature of a pre-response stale pooled-connection failure — the server tore down a kept-alive connection before sending any response bytes.This is recognized across transports as an
EOFExceptionorClosedChannelException, a connection-resetSocketException, or the JDKHttpClient's"HTTP/1.1 header parser received no bytes"message. Such a failure is safe to replay exactly once on a fresh connection provided the request cannot cause a duplicate side effect (an idempotent HTTP method, or — at a higher protocol layer — a side-effect-free operation).- Parameters:
t- The throwable to inspect. Can benull (returnsfalse ).- Returns:
true if the throwable indicates a pre-response stale-connection failure.
-