Class JerseyClientAbortLogFilter

java.lang.Object
ubic.gemma.rest.servlet.JerseyClientAbortLogFilter
All Implemented Interfaces:
jakarta.servlet.ServletContextListener, EventListener

public class JerseyClientAbortLogFilter extends Object implements jakarta.servlet.ServletContextListener
Suppresses noisy SEVERE log records that Jersey emits when a client disconnects mid-response.

The symptom: org.glassfish.jersey.server.ServerRuntime$Responder logs "Error while closing the output stream in order to commit response" at SEVERE whenever the client socket goes away before Jersey finishes writing the response — typically because the caller hit Ctrl-C, navigated away, or its HTTP client timed out. The root cause is always a org.apache.catalina.connector.ClientAbortException wrapping a Broken pipe or Connection reset IOException. There is nothing actionable the server can do — the response has already been sent past the point of repair — and the noise drowns out real errors during normal usage (browser preview probes, health checks, abandoned curl calls).

This filter installs a Filter on the Jersey Responder logger that drops only records whose thrown cause chain ends in a broken-pipe / connection-reset IOException. Everything else passes through; real Jersey response-writing errors still surface.

Registered in web.xml after JdbcDriverDeregistrationListener.

  • Constructor Details

    • JerseyClientAbortLogFilter

      public JerseyClientAbortLogFilter()
  • Method Details

    • contextInitialized

      public void contextInitialized(jakarta.servlet.ServletContextEvent sce)
      Specified by:
      contextInitialized in interface jakarta.servlet.ServletContextListener
    • contextDestroyed

      public void contextDestroyed(jakarta.servlet.ServletContextEvent sce)
      Specified by:
      contextDestroyed in interface jakarta.servlet.ServletContextListener