Class SlowRequestFilter

java.lang.Object
io.dropwizard.servlets.SlowRequestFilter
All Implemented Interfaces:
jakarta.servlet.Filter

public class SlowRequestFilter extends Object implements jakarta.servlet.Filter
A servlet filter which logs the methods and URIs of requests which take longer than a given duration of time to complete.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a filter which logs requests which take longer than 1 second.
    SlowRequestFilter(io.dropwizard.util.Duration threshold)
    Creates a filter which logs requests which take longer than the given duration.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    doFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain)
     
    void
    init(jakarta.servlet.FilterConfig filterConfig)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SlowRequestFilter

      public SlowRequestFilter()
      Creates a filter which logs requests which take longer than 1 second.
    • SlowRequestFilter

      public SlowRequestFilter(io.dropwizard.util.Duration threshold)
      Creates a filter which logs requests which take longer than the given duration.
      Parameters:
      threshold - the threshold for considering a request slow
  • Method Details

    • init

      public void init(jakarta.servlet.FilterConfig filterConfig) throws jakarta.servlet.ServletException
      Specified by:
      init in interface jakarta.servlet.Filter
      Throws:
      jakarta.servlet.ServletException
    • destroy

      public void destroy()
      Specified by:
      destroy in interface jakarta.servlet.Filter
    • doFilter

      public void doFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain) throws IOException, jakarta.servlet.ServletException
      Specified by:
      doFilter in interface jakarta.servlet.Filter
      Throws:
      IOException
      jakarta.servlet.ServletException