Class RequestEndedEvent
- All Implemented Interfaces:
Serializable
service event bus
when the framework has handled a request and written the response, on the
request thread and before the request interceptors run.
Besides the request, the event tells which request handler handled the
request and which exception, if any, made handling it fail. The exception has
already been passed to the session ErrorHandler at that point.
A message that a client sends through a push connection is reported without a
response and without a request handler. The daily active user tracking that
runs for some requests before they reach Flow reports its requests without a
response, session or request handler, even though the matching
RequestStartedEvent has a response, so a missing response does not by
itself mean a push message.
- Since:
- 25.4
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionRequestEndedEvent(VaadinService service, VaadinRequest request, VaadinResponse response, VaadinSession session, RequestHandler handler, Exception failure, Duration duration) Creates a new event. -
Method Summary
Modifier and TypeMethodDescriptionGets the time it took to handle the request, measured from just before theRequestStartedEventwas fired.Gets the exception that made handling the request fail.Gets the request handler that handled the request.Gets the request.Gets the response.Gets the service that handled the request.Gets the session used during the request.Methods inherited from class java.util.EventObject
getSource, toString
-
Constructor Details
-
RequestEndedEvent
public RequestEndedEvent(VaadinService service, VaadinRequest request, VaadinResponse response, VaadinSession session, RequestHandler handler, Exception failure, Duration duration) Creates a new event.- Parameters:
service- the service that handled the request, notnullrequest- the request, notnullresponse- the response, ornullfor a push messagesession- the session used during the request, ornullif the request did not use a sessionhandler- the request handler that handled the request, ornullif no request handler handled itfailure- the exception that made handling the request fail, ornullif handling it did not failduration- the time from the start of handling the request until now, notnull
-
-
Method Details
-
getService
Gets the service that handled the request.- Returns:
- the service, not
null
-
getRequest
Gets the request.- Returns:
- the request, not
null
-
getResponse
Gets the response.- Returns:
- the response, or an empty optional for a push message or a request reported by the daily active user tracking
-
getSession
Gets the session used during the request.- Returns:
- the session, or an empty optional if the request did not use a session
-
getHandler
Gets the request handler that handled the request. The type of the handler tells what kind of request it was, for exampleUidlRequestHandlerfor a client-to-server message.A push message is not handled by a request handler, and neither is a request that failed before a handler accepted it.
- Returns:
- the request handler, or an empty optional if no request handler handled the request
-
getFailure
Gets the exception that made handling the request fail.Failures of push messages are reported as well: the push handling records them with
VaadinService.recordRequestFailure(VaadinRequest, Exception).- Returns:
- the exception, or an empty optional if handling the request did not fail
-
getDuration
Gets the time it took to handle the request, measured from just before theRequestStartedEventwas fired.- Returns:
- the duration, not
null
-