java.lang.Object
com.vaadin.client.gwt.elemental.js.util.Xhr

public class Xhr extends Object
A Simpler way to use XMLHttpRequest. Copied from the GWT project to make get/post return the XmlHttpRequest
Since:
1.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Notifies when an XHR successfully completes, or errors out.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Xhr()
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.google.gwt.xhr.client.XMLHttpRequest
    get(elemental.html.Window window, String url, Xhr.Callback callback)
    Send a GET request to the url and dispatch updates to the callback.
    static com.google.gwt.xhr.client.XMLHttpRequest
    get(String url, Xhr.Callback callback)
    Send a GET request to the url and dispatch updates to the callback.
    static com.google.gwt.xhr.client.XMLHttpRequest
    Send a GET request to the url including credentials in XHR, and dispatch updates to the callback.
    static com.google.gwt.xhr.client.XMLHttpRequest
    head(elemental.html.Window window, String url, Xhr.Callback callback)
    Send a HEAD request to the url and dispatch updates to the callback.
    static com.google.gwt.xhr.client.XMLHttpRequest
    head(String url, Xhr.Callback callback)
    Send a HEAD request to the url and dispatch updates to the callback.
    static com.google.gwt.xhr.client.XMLHttpRequest
    post(elemental.html.Window window, String url, String requestData, String contentType, Xhr.Callback callback)
    Send a POST request to the url and dispatch updates to the callback.
    static com.google.gwt.xhr.client.XMLHttpRequest
    post(String url, String requestData, String contentType, Xhr.Callback callback)
    Send a POST request to the url and dispatch updates to the callback.

    Methods inherited from class java.lang.Object

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

    • Xhr

      public Xhr()
  • Method Details

    • get

      public static com.google.gwt.xhr.client.XMLHttpRequest get(String url, Xhr.Callback callback)
      Send a GET request to the url and dispatch updates to the callback.
      Parameters:
      url - the URL
      callback - the callback to be notified
      Returns:
      a reference to the sent XmlHttpRequest
    • getWithCredentials

      public static com.google.gwt.xhr.client.XMLHttpRequest getWithCredentials(String url, Xhr.Callback callback)
      Send a GET request to the url including credentials in XHR, and dispatch updates to the callback.
      Parameters:
      url - the URL
      callback - the callback to be notified
      Returns:
      a reference to the sent XmlHttpRequest
    • get

      public static com.google.gwt.xhr.client.XMLHttpRequest get(elemental.html.Window window, String url, Xhr.Callback callback)
      Send a GET request to the url and dispatch updates to the callback.
      Parameters:
      window - the window object used to access the XMLHttpRequest constructor
      url - the URL
      callback - the callback to be notified
      Returns:
      a reference to the sent XmlHttpRequest
    • head

      public static com.google.gwt.xhr.client.XMLHttpRequest head(String url, Xhr.Callback callback)
      Send a HEAD request to the url and dispatch updates to the callback.
      Parameters:
      url - the URL
      callback - the callback to be notified
      Returns:
      a reference to the sent XmlHttpRequest
    • head

      public static com.google.gwt.xhr.client.XMLHttpRequest head(elemental.html.Window window, String url, Xhr.Callback callback)
      Send a HEAD request to the url and dispatch updates to the callback.
      Parameters:
      window - the window object used to access the XMLHttpRequest constructor
      url - the URL
      callback - the callback to be notified
      Returns:
      a reference to the sent XmlHttpRequest
    • post

      public static com.google.gwt.xhr.client.XMLHttpRequest post(String url, String requestData, String contentType, Xhr.Callback callback)
      Send a POST request to the url and dispatch updates to the callback.
      Parameters:
      url - the URL
      requestData - the data to be passed to XMLHttpRequest.send
      contentType - a value for the Content-Type HTTP header
      callback - the callback to notify
      Returns:
      a reference to the sent XmlHttpRequest
    • post

      public static com.google.gwt.xhr.client.XMLHttpRequest post(elemental.html.Window window, String url, String requestData, String contentType, Xhr.Callback callback)
      Send a POST request to the url and dispatch updates to the callback.
      Parameters:
      window - the window object used to access the XMLHttpRequest constructor
      url - the URL
      requestData - the data to be passed to XMLHttpRequest.send
      contentType - a value for the Content-Type HTTP header
      callback - the callback to notify
      Returns:
      a reference to the sent XmlHttpRequest