Class ServletRequestHandledEvent
java.lang.Object
java.util.EventObject
org.springframework.context.ApplicationEvent
org.springframework.web.context.support.RequestHandledEvent
org.springframework.web.context.support.ServletRequestHandledEvent
- All Implemented Interfaces:
Serializable
Servlet-specific subclass of RequestHandledEvent,
adding servlet-specific context information.
- Since:
- 2.0
- Author:
- Juergen Hoeller
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source
-
Constructor Summary
ConstructorDescriptionServletRequestHandledEvent
(Object source, String requestUrl, String clientAddress, String method, String servletName, String sessionId, String userName, long processingTimeMillis) Create a new ServletRequestHandledEvent.ServletRequestHandledEvent
(Object source, String requestUrl, String clientAddress, String method, String servletName, String sessionId, String userName, long processingTimeMillis, Throwable failureCause) Create a new ServletRequestHandledEvent.ServletRequestHandledEvent
(Object source, String requestUrl, String clientAddress, String method, String servletName, String sessionId, String userName, long processingTimeMillis, Throwable failureCause, int statusCode) Create a new ServletRequestHandledEvent. -
Method Summary
Modifier and TypeMethodDescriptionReturn the IP address that the request came from.Return a full description of this event, involving all available context data.Return the HTTP method of the request (usually GET or POST).Return the URL of the request.Return the name of the servlet that handled the request.Return a short description of this event, only involving the most important context data.int
Return the HTTP status code of the response or -1 if the status code is not available.toString()
Methods inherited from class org.springframework.web.context.support.RequestHandledEvent
getFailureCause, getProcessingTimeMillis, getSessionId, getUserName, wasFailure
Methods inherited from class org.springframework.context.ApplicationEvent
getTimestamp
Methods inherited from class java.util.EventObject
getSource
-
Constructor Details
-
ServletRequestHandledEvent
public ServletRequestHandledEvent(Object source, String requestUrl, String clientAddress, String method, String servletName, @Nullable String sessionId, @Nullable String userName, long processingTimeMillis) Create a new ServletRequestHandledEvent.- Parameters:
source
- the component that published the eventrequestUrl
- the URL of the requestclientAddress
- the IP address that the request came frommethod
- the HTTP method of the request (usually GET or POST)servletName
- the name of the servlet that handled the requestsessionId
- the id of the HTTP session, if anyuserName
- the name of the user that was associated with the request, if any (usually the UserPrincipal)processingTimeMillis
- the processing time of the request in milliseconds
-
ServletRequestHandledEvent
public ServletRequestHandledEvent(Object source, String requestUrl, String clientAddress, String method, String servletName, @Nullable String sessionId, @Nullable String userName, long processingTimeMillis, @Nullable Throwable failureCause) Create a new ServletRequestHandledEvent.- Parameters:
source
- the component that published the eventrequestUrl
- the URL of the requestclientAddress
- the IP address that the request came frommethod
- the HTTP method of the request (usually GET or POST)servletName
- the name of the servlet that handled the requestsessionId
- the id of the HTTP session, if anyuserName
- the name of the user that was associated with the request, if any (usually the UserPrincipal)processingTimeMillis
- the processing time of the request in millisecondsfailureCause
- the cause of failure, if any
-
ServletRequestHandledEvent
public ServletRequestHandledEvent(Object source, String requestUrl, String clientAddress, String method, String servletName, @Nullable String sessionId, @Nullable String userName, long processingTimeMillis, @Nullable Throwable failureCause, int statusCode) Create a new ServletRequestHandledEvent.- Parameters:
source
- the component that published the eventrequestUrl
- the URL of the requestclientAddress
- the IP address that the request came frommethod
- the HTTP method of the request (usually GET or POST)servletName
- the name of the servlet that handled the requestsessionId
- the id of the HTTP session, if anyuserName
- the name of the user that was associated with the request, if any (usually the UserPrincipal)processingTimeMillis
- the processing time of the request in millisecondsfailureCause
- the cause of failure, if anystatusCode
- the HTTP status code of the response
-
-
Method Details
-
getRequestUrl
Return the URL of the request. -
getClientAddress
Return the IP address that the request came from. -
getMethod
Return the HTTP method of the request (usually GET or POST). -
getServletName
Return the name of the servlet that handled the request. -
getStatusCode
public int getStatusCode()Return the HTTP status code of the response or -1 if the status code is not available.- Since:
- 4.1
-
getShortDescription
Description copied from class:RequestHandledEvent
Return a short description of this event, only involving the most important context data.- Overrides:
getShortDescription
in classRequestHandledEvent
-
getDescription
Description copied from class:RequestHandledEvent
Return a full description of this event, involving all available context data.- Overrides:
getDescription
in classRequestHandledEvent
-
toString
- Overrides:
toString
in classRequestHandledEvent
-