Class RequestStartedEvent

java.lang.Object
java.util.EventObject
com.vaadin.flow.server.RequestStartedEvent
All Implemented Interfaces:
Serializable

public class RequestStartedEvent extends EventObject
Event fired through the service event bus when the framework starts handling a request, on the request thread and after the request interceptors have run.

A message that a client sends through a push connection is reported as a request of its own, without a response. The daily active user tracking that runs for some requests before they reach Flow also reports them without a response in the RequestEndedEvent, although this event has one, so a missing response does not by itself mean a push message.

Every started event is followed by a RequestEndedEvent for the same request on the same thread, so a listener may keep timing state in a ThreadLocal. Requests are handled concurrently, so listeners must expect several requests to be in flight on several threads at once.

See Also:
  • Constructor Details

    • RequestStartedEvent

      public RequestStartedEvent(VaadinService service, VaadinRequest request, VaadinResponse response)
      Creates a new event.
      Parameters:
      service - the service handling the request, not null
      request - the request, not null
      response - the response, or null for a push message
  • Method Details

    • getService

      public VaadinService getService()
      Gets the service handling the request.
      Returns:
      the service, not null
    • getRequest

      public VaadinRequest getRequest()
      Gets the request.
      Returns:
      the request, not null
    • getResponse

      public Optional<VaadinResponse> getResponse()
      Gets the response.
      Returns:
      the response, or an empty optional for a push message