Package org.springframework.web.context.support

# Class RequestHandledEvent

java.lang.Object
java.util.EventObject
org.springframework.context.ApplicationEvent
org.springframework.web.context.support.RequestHandledEvent

All Implemented Interfaces:
  `Serializable`

Direct Known Subclasses:
  `ServletRequestHandledEvent`

public class RequestHandledEvent extends org.springframework.context.ApplicationEvent
Event raised when a request is handled within an ApplicationContext.

Supported by Spring's own FrameworkServlet (through a specific ServletRequestHandledEvent subclass), but can also be raised by any other web component.

Since:
  January 17, 2001
Author:
  Rod Johnson, Juergen Hoeller
See Also:
  - `ServletRequestHandledEvent`
  - `org.springframework.web.servlet.FrameworkServlet`
  - `ApplicationEventPublisher.publishEvent(org.springframework.context.ApplicationEvent)`
  - Serialized Form

## Field Summary

### Fields inherited from class java.util.EventObject

`source`

## Constructor Summary

Constructors
Constructor
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.

## Method Summary

Modifier and Type
Method
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.

### Methods inherited from class org.springframework.context.ApplicationEvent

`getTimestamp`

### Methods inherited from class java.util.EventObject

`getSource`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### RequestHandledEvent

public RequestHandledEvent(Object source, @Nullable String sessionId, @Nullable String userName, long processingTimeMillis)
Create a new RequestHandledEvent with session information.

Parameters:
  `source` - the component that published the event
  `sessionId` - the id of the HTTP session, if any
  `userName` - 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

### RequestHandledEvent

public RequestHandledEvent(Object source, @Nullable String sessionId, @Nullable String userName, long processingTimeMillis, @Nullable Throwable failureCause)
Create a new RequestHandledEvent with session information.

Parameters:
  `source` - the component that published the event
  `sessionId` - the id of the HTTP session, if any
  `userName` - 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
  `failureCause` - the cause of failure, if any

## Method Details

### getProcessingTimeMillis

public long getProcessingTimeMillis()
Return the processing time of the request in milliseconds.

### getSessionId

@Nullable public String getSessionId()
Return the id of the HTTP session, if any.

### getUserName

@Nullable public String getUserName()
Return the name of the user that was associated with the request (usually the UserPrincipal).

See Also:
  - `HttpServletRequest.getUserPrincipal()`

### wasFailure

public boolean wasFailure()
Return whether the request failed.

### getFailureCause

@Nullable public Throwable getFailureCause()
Return the cause of failure, if any.

### getShortDescription

public String getShortDescription()
Return a short description of this event, only involving the most important context data.

### getDescription

public String getDescription()
Return a full description of this event, involving all available context data.

### toString

public String toString()

Overrides:
  `toString` in class `EventObject`