Package net.sf.basedb.util
Class QueryParameters
- java.lang.Object
-
- net.sf.basedb.util.QueryParameters
-
public class QueryParameters extends Object
Utiltity class for parsing string values in the form of HTTP request query parameters:key1=value1&key2=value2...
- Version:
- 2.6
- Author:
- nicklas
- Last modified
- $Date: 2015-05-12 11:27:08 +0200 (ti, 12 maj 2015) $
-
-
Field Summary
Fields Modifier and Type Field Description private Map<String,List<String>>
parameters
-
Constructor Summary
Constructors Modifier Constructor Description private
QueryParameters(String query)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<String>
getKeys()
Get all keys that are present in the query string.int
getNumValues(String key)
Get the number of values for a key.String
getValue(String key)
Get the (single) value for a key.List<String>
getValues(String key)
Get all values for a key.static QueryParameters
parseQueryString(String query)
Parses a string in HTTP query format (key1=value1&key2=value2...
) and returns it as a QueryParameters object.
-
-
-
Constructor Detail
-
QueryParameters
private QueryParameters(String query)
-
-
Method Detail
-
parseQueryString
public static QueryParameters parseQueryString(String query)
Parses a string in HTTP query format (key1=value1&key2=value2...
) and returns it as a QueryParameters object.- Parameters:
query
- The string to parse- Returns:
- A
QueryParameters
object
-
getValue
public String getValue(String key)
Get the (single) value for a key. If the query string contained more than one value for this key, the first value is returned.- Parameters:
key
- The key- Returns:
- The value, or null if no value was found for the key
-
getValues
public List<String> getValues(String key)
Get all values for a key.- Returns:
- A list of values, or null if no value was found for the key
-
getNumValues
public int getNumValues(String key)
Get the number of values for a key.- Parameters:
key
- The key- Returns:
- The number of values
-
-