Class RpcInvocationEvent

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

public class RpcInvocationEvent extends EventObject
Event fired to RpcInvocationListeners around the server-side handling of a single client-to-server RPC invocation (a DOM event, a @ClientCallable/template event handler, a server-side navigation, a return channel message, and so on).

A client request can carry several invocations; one event is fired per invocation. The RpcInvocationListener.invocationStarted(com.vaadin.flow.server.communication.RpcInvocationEvent), (optional) RpcInvocationListener.invocationFailed(com.vaadin.flow.server.communication.RpcInvocationEvent, java.lang.Throwable) and RpcInvocationListener.invocationEnded(com.vaadin.flow.server.communication.RpcInvocationEvent) callbacks for a single invocation are delivered on the same thread, so timing state can be kept in a thread local.

Since:
25.2
See Also:
  • Field Summary

    Fields inherited from class java.util.EventObject

    source
  • Constructor Summary

    Constructors
    Constructor
    Description
    RpcInvocationEvent(UI ui, String type, int nodeId, String name)
    Creates a new RPC invocation event.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets a human-readable identifier for the invocation, such as the DOM event name, the invoked @ClientCallable/template method name, or the navigation location.
    int
    Gets the id of the StateNode the invocation targets.
    Gets the protocol-level invocation type, for example event, publishedEventHandler, navigation or channel.
    Gets the UI the invocation is handled against.

    Methods inherited from class java.util.EventObject

    getSource, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • RpcInvocationEvent

      public RpcInvocationEvent(UI ui, String type, int nodeId, String name)
      Creates a new RPC invocation event.
      Parameters:
      ui - the UI the invocation is handled against, not null
      type - the protocol-level invocation type (for example event, publishedEventHandler, navigation, channel), not null
      nodeId - the id of the targeted StateNode, or -1 if the invocation does not target a node
      name - a human-readable identifier for the invocation (the DOM event name, the invoked method name, the navigation location, ...), or null if none applies
  • Method Details

    • getUI

      public UI getUI()
      Gets the UI the invocation is handled against.
      Returns:
      the UI, not null
    • getType

      public String getType()
      Gets the protocol-level invocation type, for example event, publishedEventHandler, navigation or channel.
      Returns:
      the invocation type, not null
    • getNodeId

      public int getNodeId()
      Gets the id of the StateNode the invocation targets.
      Returns:
      the node id, or -1 if the invocation does not target a node
    • getName

      public String getName()
      Gets a human-readable identifier for the invocation, such as the DOM event name, the invoked @ClientCallable/template method name, or the navigation location.
      Returns:
      the invocation name, or null if none applies