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
ConstructorsConstructorDescriptionRequestTimingInterceptor(org.easypeelsecurity.springdog.notification.SlowResponseEmailNotificationManager notificationManager) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidafterCompletion(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Object handler, Exception ex) Calculates the duration of the request and records it.booleanpreHandle(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, waitMethods 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:
preHandlein interfaceorg.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:
afterCompletionin interfaceorg.springframework.web.servlet.HandlerInterceptor
-