org.xwiki.gwt.user.client
Class URLUtils

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

public class URLUtils
extends Object

Provides utility methods for manipulating URLs.

Version:
$Id: bb2ae231627662e4ca45b51a2fd9c77e97ae226a $

Field Summary
static String QUERY_STRING_COMPONENT_SEPARATOR
          The query string component separator.
 
Constructor Summary
protected URLUtils()
          Constructor.
 
Method Summary
static String getQueryString(String url)
          Extracts the query string from the given URL.
static Map<String,List<String>> parseQueryString(String queryString)
          Parses the given query string and decodes the parameter names and values.
static String serializeQueryStringParameters(Map<String,?> parameters)
          Serializes the given parameters into a query string.
static String setQueryString(String url, Map<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 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 String getQueryString(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 String setQueryString(String url,
                                    Map<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 Map<String,List<String>> parseQueryString(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 String serializeQueryStringParameters(Map<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–2014 XWiki. All rights reserved.