Package com.vaadin.client.communication
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 Summary
Constructors Constructor Description RequestResponseTracker(Registry registry)Creates a new instance connected to the given registry.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.web.bindery.event.shared.HandlerRegistrationaddRequestStartingHandler(RequestStartingEvent.Handler handler)Adds a handler forRequestStartingEvents.com.google.web.bindery.event.shared.HandlerRegistrationaddResponseHandlingEndedHandler(ResponseHandlingEndedEvent.Handler handler)Adds a handler forResponseHandlingEndedEvents.com.google.web.bindery.event.shared.HandlerRegistrationaddResponseHandlingStartedHandler(ResponseHandlingStartedEvent.Handler handler)Adds a handler forResponseHandlingStartedEvents.voidendRequest()Marks that the current request has ended.booleanhasActiveRequest()Checks is there is an active UIDL request.voidstartRequest()Marks that a new request has started.
-
-
-
Constructor Detail
-
RequestResponseTracker
public RequestResponseTracker(Registry registry)
Creates a new instance connected to the given registry.- Parameters:
registry- the global registry
-
-
Method Detail
-
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
-
-