Package com.vaadin.client.communication
Class RequestResponseTracker
java.lang.Object
com.vaadin.client.communication.RequestResponseTracker
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 Summary
ConstructorsConstructorDescriptionRequestResponseTracker(Registry registry) Creates a new instance connected to the given registry. -
Method Summary
Modifier and TypeMethodDescriptioncom.google.web.bindery.event.shared.HandlerRegistrationAdds a handler forReconnectionAttemptEvents.com.google.web.bindery.event.shared.HandlerRegistrationAdds a handler forRequestStartingEvents.com.google.web.bindery.event.shared.HandlerRegistrationAdds a handler forResponseHandlingEndedEvents.com.google.web.bindery.event.shared.HandlerRegistrationAdds a handler forResponseHandlingStartedEvents.voidMarks that the current request has ended.booleanChecks is there is an active UIDL request.voidMarks that a new request has started.
-
Constructor Details
-
RequestResponseTracker
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 notendRequest().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 notendRequest().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 forRequestStartingEvents.- 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 forResponseHandlingStartedEvents.- 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 forResponseHandlingEndedEvents.- 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 forReconnectionAttemptEvents.- Parameters:
handler- the handler to add- Returns:
- a registration object which can be used to remove the handler
-