org.xwiki.gwt.user.client
Class URLUtils

java.lang.Object
  extended by org.xwiki.gwt.user.client.URLUtils

public class URLUtils
extends java.lang.Object

Provides utility methods for manipulating URLs.

Version:
$Id: URLUtils.java 31105 2010-09-14 15:01:16Z mflorea $

Field Summary
static java.lang.String QUERY_STRING_COMPONENT_SEPARATOR
          The query string component separator.
 
Constructor Summary
protected URLUtils()
          Constructor.
 
Method Summary
static java.lang.String getQueryString(java.lang.String url)
          Extracts the query string from the given URL.
static java.util.Map<java.lang.String,java.util.List<java.lang.String>> parseQueryString(java.lang.String queryString)
          Parses the given query string and decodes the parameter names and values.
static java.lang.String serializeQueryStringParameters(java.util.Map<java.lang.String,?> parameters)
          Serializes the given parameters into a query string.
static java.lang.String setQueryString(java.lang.String url, java.util.Map<java.lang.String,?> parameters)
          Replaces the query string of the given URL and returns the result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUERY_STRING_COMPONENT_SEPARATOR

public static final java.lang.String QUERY_STRING_COMPONENT_SEPARATOR
The query string component separator.

See Also:
Constant Field Values
Constructor Detail

URLUtils

protected URLUtils()
Constructor.

Method Detail

getQueryString

public static java.lang.String getQueryString(java.lang.String url)
Extracts the query string from the given URL.

Parameters:
url - the URL to extract the query string from
Returns:
the query string of the given URL, empty string if the given URL doesn't have a query string

setQueryString

public static java.lang.String setQueryString(java.lang.String url,
                                              java.util.Map<java.lang.String,?> parameters)
Replaces the query string of the given URL and returns the result.

Parameters:
url - the URL whose query string is changed
parameters - the map of query string parameters
Returns:
a new URL that has the specified query string

parseQueryString

public static java.util.Map<java.lang.String,java.util.List<java.lang.String>> parseQueryString(java.lang.String queryString)
Parses the given query string and decodes the parameter names and values.

Parameters:
queryString - the query string to be parsed
Returns:
the map of query string parameters

serializeQueryStringParameters

public static java.lang.String serializeQueryStringParameters(java.util.Map<java.lang.String,?> parameters)
Serializes the given parameters into a query string.

Parameters:
parameters - the parameters to serialize
Returns:
a query string that includes the given parameters


Copyright © 2004-2011 XWiki. All Rights Reserved.