public class RequestHandledEvent extends ApplicationEvent
Supported by Spring's own FrameworkServlet (through a specific ServletRequestHandledEvent subclass), but can also be raised by any other web component. Used, for example, by Spring's out-of-the-box PerformanceMonitorListener.
ServletRequestHandledEvent
,
FrameworkServlet
,
ApplicationEventPublisher.publishEvent(org.springframework.context.ApplicationEvent)
,
Serialized FormConstructor and Description |
---|
RequestHandledEvent(java.lang.Object source,
java.lang.String sessionId,
java.lang.String userName,
long processingTimeMillis)
Create a new RequestHandledEvent with session information.
|
RequestHandledEvent(java.lang.Object source,
java.lang.String sessionId,
java.lang.String userName,
long processingTimeMillis,
java.lang.Throwable failureCause)
Create a new RequestHandledEvent with session information.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getDescription()
Return a full description of this event, involving
all available context data.
|
java.lang.Throwable |
getFailureCause()
Return the cause of failure, if any.
|
long |
getProcessingTimeMillis()
Return the processing time of the request in milliseconds.
|
java.lang.String |
getSessionId()
Return the id of the HTTP session, if any.
|
java.lang.String |
getShortDescription()
Return a short description of this event, only involving
the most important context data.
|
java.lang.String |
getUserName()
Return the name of the user that was associated with the request
(usually the UserPrincipal).
|
java.lang.String |
toString() |
boolean |
wasFailure()
Return whether the request failed.
|
getTimestamp
public RequestHandledEvent(java.lang.Object source, @Nullable java.lang.String sessionId, @Nullable java.lang.String userName, long processingTimeMillis)
source
- the component that published the eventsessionId
- 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 millisecondspublic RequestHandledEvent(java.lang.Object source, @Nullable java.lang.String sessionId, @Nullable java.lang.String userName, long processingTimeMillis, @Nullable java.lang.Throwable failureCause)
source
- the component that published the eventsessionId
- 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 anypublic long getProcessingTimeMillis()
@Nullable public java.lang.String getSessionId()
@Nullable public java.lang.String getUserName()
HttpServletRequest.getUserPrincipal()
public boolean wasFailure()
@Nullable public java.lang.Throwable getFailureCause()
public java.lang.String getShortDescription()
public java.lang.String getDescription()
public java.lang.String toString()
toString
in class java.util.EventObject