Package com.vaadin.client.communication
Class XhrConnection
- java.lang.Object
-
- com.vaadin.client.communication.XhrConnection
-
public class XhrConnection extends Object
Provides a connection to the /UIDL url on the server and knows how to send messages to that end point.- Since:
- 7.6
- Author:
- Vaadin Ltd
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classXhrConnection.XhrResponseHandler
-
Constructor Summary
Constructors Constructor Description XhrConnection()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidaddXsrfHeaderFromCookie(com.google.gwt.http.client.RequestBuilder rb)protected XhrConnection.XhrResponseHandlercreateResponseHandler()protected StringgetUri()Retrieves the URI to use when sending RPCs to the server.voidregisterClosingHandler()Register a window closing handler, utilizing the "pagehide" event instead of the onunload event as GWT does.voidsend(elemental.json.JsonObject payload)Sends an asynchronous UIDL request to the server using the given URI.voidsetConnection(ApplicationConnection connection)Sets the application connection this instance is connected to.
-
-
-
Method Detail
-
registerClosingHandler
public void registerClosingHandler()
Register a window closing handler, utilizing the "pagehide" event instead of the onunload event as GWT does. This calls the usual onWindowClosing() method as the pagehide event is triggered. This method should only be called once; no effort is made to prevent it being called more than once as any approach towards that would add an additional point of failure.
-
setConnection
public void setConnection(ApplicationConnection connection)
Sets the application connection this instance is connected to. Called internally by the framework.- Parameters:
connection- the application connection this instance is connected to
-
createResponseHandler
protected XhrConnection.XhrResponseHandler createResponseHandler()
-
send
public void send(elemental.json.JsonObject payload)
Sends an asynchronous UIDL request to the server using the given URI.- Parameters:
payload- The URI to use for the request. May includes GET parameters- Throws:
com.google.gwt.http.client.RequestException- if the request could not be sent
-
getUri
protected String getUri()
Retrieves the URI to use when sending RPCs to the server.- Returns:
- The URI to use for server messages.
-
addXsrfHeaderFromCookie
public static void addXsrfHeaderFromCookie(com.google.gwt.http.client.RequestBuilder rb)
-
-