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
public class ServletRequestHandledEvent extends RequestHandledEvent
Servlet-specific subclass of RequestHandledEvent, adding servlet-specific context information.- Since:
- 2.0
- Author:
- Juergen Hoeller
- See Also:
FrameworkServlet,ApplicationEventPublisher.publishEvent(org.springframework.context.ApplicationEvent), Serialized Form
Field Summary
Fields inherited from class java.util.EventObject
source
Constructor Summary
Constructors Constructor Description ServletRequestHandledEvent(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetClientAddress()Return the IP address that the request came from.StringgetDescription()Return a full description of this event, involving all available context data.StringgetMethod()Return the HTTP method of the request (usually GET or POST).StringgetRequestUrl()Return the URL of the request.StringgetServletName()Return the name of the servlet that handled the request.StringgetShortDescription()Return a short description of this event, only involving the most important context data.intgetStatusCode()Return the HTTP status code of the response or -1 if the status code is not available.StringtoString()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 Detail
ServletRequestHandledEvent
public ServletRequestHandledEvent(Object source, String requestUrl, String clientAddress, String method, String servletName, String sessionId, 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, String sessionId, String userName, long processingTimeMillis, 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, String sessionId, String userName, long processingTimeMillis, 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 Detail
getRequestUrl
public String getRequestUrl()
Return the URL of the request.
getClientAddress
public String getClientAddress()
Return the IP address that the request came from.
getServletName
public String 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
public String getShortDescription()
Description copied from class:RequestHandledEventReturn a short description of this event, only involving the most important context data.- Overrides:
getShortDescriptionin classRequestHandledEvent
getDescription
public String getDescription()
Description copied from class:RequestHandledEventReturn a full description of this event, involving all available context data.- Overrides:
getDescriptionin classRequestHandledEvent
toString
public String toString()
- Overrides:
toStringin classRequestHandledEvent