Top Description Fields Constructors Methods
org.springframework.web.util

public Class DisconnectedClientHelper

extends Object
Class Inheritance
Imports
java.util.Set, org.apache.commons.logging.Log, .LogFactory, org.springframework.core.NestedExceptionUtils, org.springframework.util.Assert

Utility methods to assist with identifying and logging exceptions that indicate the client has gone away. Such exceptions fill logs with unnecessary stack traces. The utility methods help to log a single line message at DEBUG level, and a full stacktrace at TRACE level.
Author
Rossen Stoyanchev
Since
6.1

Field Summary

Modifier and TypeField and Description
private static final Set<String>
private static final Set<String>
private final Log

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
checkAndLogClientDisconnectedException(Throwable ex)

Check via isClientDisconnectedException if the exception indicates the remote client disconnected, and if so log a single line message when DEBUG is on, and a full stacktrace when TRACE is on for the configured logger.

public static boolean
isClientDisconnectedException(Throwable ex)

Whether the given exception indicates the client has gone away.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

EXCEPTION_PHRASESback to summary
private static final Set<String> EXCEPTION_PHRASES
EXCEPTION_TYPE_NAMESback to summary
private static final Set<String> EXCEPTION_TYPE_NAMES
loggerback to summary
private final Log logger

Constructor Detail

DisconnectedClientHelperback to summary
public DisconnectedClientHelper(String logCategory)

Method Detail

checkAndLogClientDisconnectedExceptionback to summary
public boolean checkAndLogClientDisconnectedException(Throwable ex)

Check via isClientDisconnectedException if the exception indicates the remote client disconnected, and if so log a single line message when DEBUG is on, and a full stacktrace when TRACE is on for the configured logger.

isClientDisconnectedExceptionback to summary
public static boolean isClientDisconnectedException(Throwable ex)

Whether the given exception indicates the client has gone away. Known cases covered:

  • ClientAbortException or EOFException for Tomcat
  • EofException for Jetty
  • IOException "Broken pipe" or "connection reset by peer"