Class RequestResponseTracker

java.lang.Object
com.vaadin.client.communication.RequestResponseTracker

public class RequestResponseTracker extends Object
Tracks active server UIDL requests.

Ensures that there is only one outgoing server request active at a given time.

Fires events when a requests starts, response handling starts and when response handling ends.

Since:
1.0
Author:
Vaadin Ltd
  • Constructor Details

    • RequestResponseTracker

      public RequestResponseTracker(Registry registry)
      Creates a new instance connected to the given registry.
      Parameters:
      registry - the global registry
  • Method Details

    • startRequest

      public void startRequest()
      Marks that a new request has started.

      Should not be called when a request is in progress, i.e. startRequest() has been called but not endRequest().

      Fires a RequestStartingEvent.

    • hasActiveRequest

      public boolean hasActiveRequest()
      Checks is there is an active UIDL request.
      Returns:
      true if there is an active request, false otherwise
    • endRequest

      public void endRequest()
      Marks that the current request has ended.

      Should not be called unless a request is in progress, i.e. startRequest() has been called but not endRequest().

      Will trigger sending of any pending invocations to the server.

      Fires a ResponseHandlingEndedEvent.

    • addRequestStartingHandler

      public com.google.web.bindery.event.shared.HandlerRegistration addRequestStartingHandler(RequestStartingEvent.Handler handler)
      Adds a handler for RequestStartingEvents.
      Parameters:
      handler - the handler to add
      Returns:
      a registration object which can be used to remove the handler
    • addResponseHandlingStartedHandler

      public com.google.web.bindery.event.shared.HandlerRegistration addResponseHandlingStartedHandler(ResponseHandlingStartedEvent.Handler handler)
      Adds a handler for ResponseHandlingStartedEvents.
      Parameters:
      handler - the handler to add
      Returns:
      a registration object which can be used to remove the handler
    • addResponseHandlingEndedHandler

      public com.google.web.bindery.event.shared.HandlerRegistration addResponseHandlingEndedHandler(ResponseHandlingEndedEvent.Handler handler)
      Adds a handler for ResponseHandlingEndedEvents.
      Parameters:
      handler - the handler to add
      Returns:
      a registration object which can be used to remove the handler
    • addReconnectionAttemptHandler

      public com.google.web.bindery.event.shared.HandlerRegistration addReconnectionAttemptHandler(ReconnectionAttemptEvent.Handler handler)
      Adds a handler for ReconnectionAttemptEvents.
      Parameters:
      handler - the handler to add
      Returns:
      a registration object which can be used to remove the handler