GWT 2.7.0

com.google.gwt.user.client
Class Window.Location

java.lang.Object
  extended by com.google.gwt.user.client.Window.Location
Enclosing class:
Window

public static class Window.Location
extends java.lang.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 Summary
static void assign(java.lang.String newURL)
          Assigns the window to a new URL.
(package private) static java.util.Map<java.lang.String,java.util.List<java.lang.String>> buildListParamMap(java.lang.String queryString)
          Builds the immutable map from String to List that we'll return in getParameterMap().
static UrlBuilder createUrlBuilder()
          Create a UrlBuilder based on this Window.Location.
static java.lang.String getHash()
          Gets the string to the right of the URL's hash.
static java.lang.String getHost()
          Gets the URL's host and port name.
static java.lang.String getHostName()
          Gets the URL's host name.
static java.lang.String getHref()
          Gets the entire URL.
static java.lang.String getParameter(java.lang.String name)
          Gets the URL's parameter of the specified name.
static java.util.Map<java.lang.String,java.util.List<java.lang.String>> getParameterMap()
          Returns an immutable Map of the URL query parameters for the host page at the time this method was called.
static java.lang.String getPath()
          Gets the path to the URL.
static java.lang.String getPort()
          Gets the URL's port.
static java.lang.String getProtocol()
          Gets the URL's protocol.
static java.lang.String getQueryString()
          Gets the URL's query string.
static void reload()
          Reloads the current browser window.
static void replace(java.lang.String newURL)
          Replaces the current URL with a new one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

assign

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

Parameters:
newURL - the new URL

createUrlBuilder

public static UrlBuilder createUrlBuilder()
Create a UrlBuilder based on this Window.Location.

Returns:
the new builder

getHash

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

Returns:
the string to the right of the URL's hash.

getHost

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

Returns:
the host and port name

getHostName

public static java.lang.String getHostName()
Gets the URL's host name.

Returns:
the host name

getHref

public static java.lang.String getHref()
Gets the entire URL.

Returns:
the URL

getParameter

public static java.lang.String getParameter(java.lang.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.

Parameters:
name - the name of the URL's parameter
Returns:
the value of the URL's parameter, or null if missing

getParameterMap

public static java.util.Map<java.lang.String,java.util.List<java.lang.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.

Returns:
a map from URL query parameter names to a list of values

getPath

public static java.lang.String getPath()
Gets the path to the URL.

Returns:
the path to the URL.

getPort

public static java.lang.String getPort()
Gets the URL's port.

Returns:
the URL's port

getProtocol

public static java.lang.String getProtocol()
Gets the URL's protocol.

Returns:
the URL's protocol.

getQueryString

public static java.lang.String getQueryString()
Gets the URL's query string.

Returns:
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(java.lang.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.

Parameters:
newURL - the new URL

buildListParamMap

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

Returns:
a map from the

GWT 2.7.0