com.norconex.commons.lang.url
Class QueryString
java.lang.Object
java.util.AbstractMap<K,V>
java.util.TreeMap<String,List<String>>
com.norconex.commons.lang.map.Properties
com.norconex.commons.lang.url.QueryString
- All Implemented Interfaces:
- Serializable, Cloneable, Map<String,List<String>>, NavigableMap<String,List<String>>, SortedMap<String,List<String>>
public class QueryString
- extends Properties
Provides utility methods for getting and setting attributes on
a URL query string.
- Author:
- Pascal Essiembre
- See Also:
- Serialized Form
Methods inherited from class com.norconex.commons.lang.map.Properties |
addBigDecimal, addBoolean, addClass, addDate, addDouble, addFile, addFloat, addInt, addLocale, addLong, addString, get, getBigDecimal, getBigDecimal, getBigDecimals, getBoolean, getBoolean, getBooleans, getClass, getClass, getClasses, getDate, getDate, getDates, getDouble, getDouble, getDoubles, getFile, getFile, getFiles, getFloat, getFloat, getFloats, getInt, getInt, getInts, getLocale, getLocale, getLocales, getLong, getLong, getLongs, getString, getString, getStrings, load, load, load, load, loadFromString, loadFromXML, loadFromXML, remove, setBigDecimal, setBigDecimal, setBoolean, setBoolean, setClass, setDate, setDouble, setFile, setFloat, setInt, setLocale, setLong, setString, store, store, store, store, storeToString, storeToXML, storeToXML, storeToXML |
Methods inherited from class java.util.TreeMap |
ceilingEntry, ceilingKey, clear, clone, comparator, containsKey, containsValue, descendingKeySet, descendingMap, entrySet, firstEntry, firstKey, floorEntry, floorKey, headMap, headMap, higherEntry, higherKey, keySet, lastEntry, lastKey, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, put, putAll, size, subMap, subMap, tailMap, tailMap, values |
QueryString
public QueryString()
QueryString
public QueryString(URL urlWithQueryString)
- Default URL character encoding is UTF-8.
- Parameters:
urlWithQueryString
-
QueryString
public QueryString(URL urlWithQueryString,
String encoding)
QueryString
public QueryString(String urlWithQueryString)
- Constructor. Default URL character encoding is UTF-8.
It is possible to only supply a query string as opposed to an
entire URL.
Key and values making up a query string are assumed to be URL-encoded.
Will throw a
URLException
if UTF-8 encoding is not supported.
- Parameters:
urlWithQueryString
- a URL from which to extract a query string.
QueryString
public QueryString(String urlWithQueryString,
String encoding)
- Constructor.
It is possible to only supply a query string as opposed to an
entire URL.
Key and values making up a query string are assumed to be URL-encoded.
Will throw a
URLException
if the supplied encoding is
unsupported or invalid.
- Parameters:
urlWithQueryString
- a URL from which to extract a query string.encoding
- character encoding
toString
public String toString()
- Convert this
QueryString
to a URL-encoded string
representation that can be appended as is to a URL with no query string.
- Overrides:
toString
in class AbstractMap<String,List<String>>
applyOnURL
public String applyOnURL(String url)
- Apply this url QueryString on the given URL. If a query string already
exists, it is replaced by this one.
- Parameters:
url
- the URL to apply this query string.
- Returns:
- url with query string added
applyOnURL
public URL applyOnURL(URL url)
Copyright © 2008-2013 Norconex Inc.. All Rights Reserved.