Class Window.Location

Enclosing class:

public static class Window.Location extends Object
This class provides access to the browser's location's object. The location object contains information about the current URL and methods to manipulate it. Location is a very simple wrapper, so not all browser quirks are hidden from the user.
  • Method Details

    • assign

      public static void assign(String newURL)
      Assigns the window to a new URL. All GWT state will be lost.
      newURL - the new URL
    • createUrlBuilder

      public static UrlBuilder createUrlBuilder()
      Create a UrlBuilder based on this Window.Location.
      the new builder
    • getHash

      public static String getHash()
      Gets the string to the right of the URL's hash.
      the string to the right of the URL's hash.
    • getHost

      public static String getHost()
      Gets the URL's host and port name.
      the host and port name
    • getHostName

      public static String getHostName()
      Gets the URL's host name.
      the host name
    • getHref

      public static String getHref()
      Gets the entire URL.
      the URL
    • getParameter

      public static String getParameter(String name)
      Gets the URL's parameter of the specified name. Note that if multiple parameters have been specified with the same name, the last one will be returned.
      name - the name of the URL's parameter
      the value of the URL's parameter, or null if missing
    • getParameterMap

      public static Map<String,List<String>> getParameterMap()
      Returns an immutable Map of the URL query parameters for the host page at the time this method was called. Any changes to the window's location will be reflected in the result of subsequent calls.
      a map from URL query parameter names to a list of values
    • getPath

      public static String getPath()
      Gets the path to the URL.
      the path to the URL.
    • getPort

      public static String getPort()
      Gets the URL's port.
      the URL's port
    • getProtocol

      public static String getProtocol()
      Gets the URL's protocol.
      the URL's protocol.
    • getQueryString

      public static String getQueryString()
      Gets the URL's query string.
      the URL's query string
    • reload

      public static void reload()
      Reloads the current browser window. All GWT state will be lost.
    • replace

      public static void replace(String newURL)
      Replaces the current URL with a new one. All GWT state will be lost. In the browser's history, the current URL will be replaced by the new URL.
      newURL - the new URL
    • buildListParamMap

      static Map<String,List<String>> buildListParamMap(String queryString)
      Builds the immutable map from String to List that we'll return in getParameterMap(). Package-protected for testing.
      a map from the