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 Formsource
Constructor and Description |
---|
RequestHandledEvent(Object source,
String sessionId,
String userName,
long processingTimeMillis)
Create a new RequestHandledEvent with session information.
|
RequestHandledEvent(Object source,
String sessionId,
String userName,
long processingTimeMillis,
Throwable failureCause)
Create a new RequestHandledEvent with session information.
|
Modifier and Type | Method and Description |
---|---|
String |
getDescription()
Return a full description of this event, involving
all available context data.
|
Throwable |
getFailureCause()
Return the cause of failure, if any.
|
long |
getProcessingTimeMillis()
Return the processing time of the request in milliseconds.
|
String |
getSessionId()
Return the id of the HTTP session, if any.
|
String |
getShortDescription()
Return a short description of this event, only involving
the most important context data.
|
String |
getUserName()
Return the name of the user that was associated with the request
(usually the UserPrincipal).
|
String |
toString() |
boolean |
wasFailure()
Return whether the request failed.
|
getTimestamp
getSource
public RequestHandledEvent(Object source, @Nullable String sessionId, @Nullable 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(Object source, @Nullable String sessionId, @Nullable String userName, long processingTimeMillis, @Nullable 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 String getUserName()
HttpServletRequest.getUserPrincipal()
public boolean wasFailure()
public String getShortDescription()
public String getDescription()
public String toString()
toString
in class EventObject