Class RequestTimingInterceptor

java.lang.Object
org.easypeelsecurity.springdog.manager.statistics.RequestTimingInterceptor
All Implemented Interfaces:
org.springframework.web.servlet.HandlerInterceptor

@Component public class RequestTimingInterceptor extends Object implements org.springframework.web.servlet.HandlerInterceptor
Interceptor to measure and record the response times of HTTP requests. This interceptor stores the duration of each request, categorized by the request method and URI. The recorded times can be retrieved for monitoring and analysis purposes.
  • Constructor Summary

    Constructors
    Constructor
    Description
    RequestTimingInterceptor(org.easypeelsecurity.springdog.notification.SlowResponseEmailNotificationManager notificationManager)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    afterCompletion(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler, Exception ex)
    Calculates the duration of the request and records it.
    boolean
    preHandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler)
    Records the start time of the request.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.web.servlet.HandlerInterceptor

    postHandle
  • Constructor Details

    • RequestTimingInterceptor

      public RequestTimingInterceptor(org.easypeelsecurity.springdog.notification.SlowResponseEmailNotificationManager notificationManager)
      Constructor.
  • Method Details

    • preHandle

      public boolean preHandle(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler)
      Records the start time of the request.
      Specified by:
      preHandle in interface org.springframework.web.servlet.HandlerInterceptor
    • afterCompletion

      public void afterCompletion(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler, Exception ex)
      Calculates the duration of the request and records it.
      Specified by:
      afterCompletion in interface org.springframework.web.servlet.HandlerInterceptor