Class ClientAborts
A client that closes its connection mid-response (closed browser tab, cancelled request, timed-out proxy) is routine,
not a server error. Servlet containers surface it as an IOException from the response output stream or
writer, but the concrete type is container-specific. This class detects it without a compile-time dependency on any
container.
Example:
Not part of the public REST API; subject to change without notice.
- Since:
- 10.0.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanReturnstrue if the specified throwable, or anything in its cause chain, indicates that the client disconnected.static booleanReturnstrue only if the throwable, or anything in its cause chain, is a servlet-container client-abort type.
-
Method Details
-
isClientAbort
Returnstrue if the specified throwable, or anything in its cause chain, indicates that the client disconnected.The cause chain is walked up to a bounded depth and guarded against cycles. A throwable matches if it is:
- A class whose simple name is
ClientAbortException (Tomcat; matched by name so there is no Tomcat dependency). - An
EOFException(Jetty'sEofException extends it). - A
ClosedChannelException. - An
IOExceptionwhose message contains"broken pipe" or"connection reset" (case-insensitive).
- Parameters:
t- The throwable to test. Can benull .- Returns:
true if the throwable represents a client abort.
- A class whose simple name is
-
isContainerClientAbort
Returnstrue only if the throwable, or anything in its cause chain, is a servlet-container client-abort type.Matches only classes whose simple name is
ClientAbortException (Tomcat, which wraps every response write/flush failure in it) orEofException (Jetty). UnlikeisClientAbort(Throwable), plainEOFException,ClosedChannelExceptionand "broken pipe"/"connection reset"IOExceptions do not match.Use this where the failure could have come from somewhere other than the client socket (e.g. an exception escaping operation execution or response rendering, where a backend call might also have reset). Use the lenient
isClientAbort(Throwable)only for response flush paths, where the failure is necessarily on the client socket.- Parameters:
t- The throwable to test. Can benull .- Returns:
true if the throwable represents a container-reported client abort.
-