public static class

Window.Location

extends Object
java.lang.Object
   ↳ com.google.gwt.user.client.Window.Location

Class Overview

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.

Summary

Public Methods
static void assign(String newURL)
Assigns the window to a new URL.
static UrlBuilder createUrlBuilder()
Create a UrlBuilder based on this Window.Location.
static String getHash()
Gets the string to the right of the URL's hash.
static String getHost()
Gets the URL's host and port name.
static String getHostName()
Gets the URL's host name.
static String getHref()
Gets the entire URL.
static String getParameter(String name)
Gets the URL's parameter of the specified name.
static Map<StringList<String>> getParameterMap()
Returns a Map of the URL query parameters for the host page; since changing the map would not change the window's location, the map returned is immutable.
static String getPath()
Gets the path to the URL.
static String getPort()
Gets the URL's port.
static String getProtocol()
Gets the URL's protocol.
static String getQueryString()
Gets the URL's query string.
static void reload()
Reloads the current browser window.
static void replace(String newURL)
Replaces the current URL with a new one.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static void assign (String newURL)

Assigns the window to a new URL. All GWT state will be lost.

Parameters
newURL the new URL

public static UrlBuilder createUrlBuilder ()

Create a UrlBuilder based on this Window.Location.

Returns
  • the new builder

public static String getHash ()

Gets the string to the right of the URL's hash.

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

public static String getHost ()

Gets the URL's host and port name.

Returns
  • the host and port name

public static String getHostName ()

Gets the URL's host name.

Returns
  • the host name

public static String getHref ()

Gets the entire URL.

Returns
  • the URL

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.

Parameters
name the name of the URL's parameter
Returns
  • the value of the URL's parameter

public static Map<StringList<String>> getParameterMap ()

Returns a Map of the URL query parameters for the host page; since changing the map would not change the window's location, the map returned is immutable.

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

public static String getPath ()

Gets the path to the URL.

Returns
  • the path to the URL.

public static String getPort ()

Gets the URL's port.

Returns
  • the URL's port

public static String getProtocol ()

Gets the URL's protocol.

Returns
  • the URL's protocol.

public static String getQueryString ()

Gets the URL's query string.

Returns
  • the URL's query string

public static void reload ()

Reloads the current browser window. All GWT state will be lost.

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.

Parameters
newURL the new URL