Class ServiceInitEvent

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

public class ServiceInitEvent extends EventObject
Event fired to VaadinServiceInitListener when a VaadinService is being initialized.

This event can also be used to add RequestHandlers that will be used by the VaadinService for handling all requests.

Since:
1.0
Author:
Vaadin Ltd
See Also:
  • Constructor Details

    • ServiceInitEvent

      public ServiceInitEvent(VaadinService service)
      Creates a new service init event for a given VaadinService and the RequestHandler that will be used by the service.
      Parameters:
      service - the Vaadin service of this request
  • Method Details

    • addRequestHandler

      public void addRequestHandler(RequestHandler requestHandler)
      Adds a new request handler that will be used by this service. The added handler will be run before any of the framework's own request handlers, but the ordering relative to other custom handlers is not guaranteed.
      Parameters:
      requestHandler - the request handler to add, not null
    • addIndexHtmlRequestListener

      public void addIndexHtmlRequestListener(IndexHtmlRequestListener indexHtmlRequestListener)
      Adds a new Index HTML request listener that will be used by this service. The ordering of multiple added bootstrap listeners is not guaranteed.
      Parameters:
      indexHtmlRequestListener - the Index HTML request listener to be added.
    • addDependencyFilter

      public void addDependencyFilter(DependencyFilter dependencyFilter)
      Adds a new dependency filter that will be used by this service.
      Parameters:
      dependencyFilter - the dependency filter to add, not null
    • addVaadinRequestInterceptor

      public void addVaadinRequestInterceptor(VaadinRequestInterceptor vaadinRequestInterceptor)
      Adds a new request interceptor that will be used by this service.
      Parameters:
      vaadinRequestInterceptor - the request interceptor to add, not null
    • setExecutor

      public void setExecutor(Executor executor)
      Sets the Executor to be used by Vaadin for running asynchronous tasks.

      The application can also benefit from this executor to submit its own asynchronous tasks.

      The developer is responsible for managing the executor's lifecycle, for example, by registering a VaadinService destroy listener to shut it down.

      A null value can be given to switch back to the Vaadin default executor.

      Parameters:
      executor - the executor to set.
    • getAddedRequestHandlers

      public Stream<RequestHandler> getAddedRequestHandlers()
      Gets a stream of all custom request handlers that have been added for the service.
      Returns:
      the stream of added request handlers
    • getAddedIndexHtmlRequestListeners

      public Stream<IndexHtmlRequestListener> getAddedIndexHtmlRequestListeners()
      Gets a stream of all Index HTML request listeners that have been added for the service.
      Returns:
      the stream of added Index HTML request listeners
    • getAddedDependencyFilters

      public Stream<DependencyFilter> getAddedDependencyFilters()
      Gets a stream of all dependency filters that have been added for the service.
      Returns:
      the stream of added dependency filters
    • getAddedVaadinRequestInterceptor

      public Stream<VaadinRequestInterceptor> getAddedVaadinRequestInterceptor()
      Gets a stream of all Vaadin request interceptors that have been added for the service.
      Returns:
      the stream of added request interceptors
    • getExecutor

      public Optional<Executor> getExecutor()
      Gets the optional Executor that is currently set to be used by Vaadin for running asynchronous tasks.
      Returns:
      an Optional containing the Executor, or an empty Optional if no executor is set.
    • getSource

      public VaadinService getSource()
      Overrides:
      getSource in class EventObject