Package io.dropwizard.servlets
Class SlowRequestFilter
- java.lang.Object
-
- io.dropwizard.servlets.SlowRequestFilter
-
- All Implemented Interfaces:
javax.servlet.Filter
public class SlowRequestFilter extends Object implements javax.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 SlowRequestFilter()
Creates a filter which logs requests which take longer than 1 second.SlowRequestFilter(Duration threshold)
Creates a filter which logs requests which take longer than the given duration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
void
doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
void
init(javax.servlet.FilterConfig filterConfig)
-
-
-
Constructor Detail
-
SlowRequestFilter
public SlowRequestFilter()
Creates a filter which logs requests which take longer than 1 second.
-
SlowRequestFilter
public SlowRequestFilter(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 Detail
-
init
public void init(javax.servlet.FilterConfig filterConfig) throws javax.servlet.ServletException
- Specified by:
init
in interfacejavax.servlet.Filter
- Throws:
javax.servlet.ServletException
-
destroy
public void destroy()
- Specified by:
destroy
in interfacejavax.servlet.Filter
-
doFilter
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException
- Specified by:
doFilter
in interfacejavax.servlet.Filter
- Throws:
IOException
javax.servlet.ServletException
-
-