2.17.2: 2011-06-17

net.sf.basedb.util
Class QueryParameters

java.lang.Object
  extended by 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: 2008-09-11 22:08:14 +0200 (Thu, 11 Sep 2008) $

Field Summary
private  Map<String,List<String>> parameters
           
 
Constructor Summary
private QueryParameters(String query)
           
 
Method Summary
 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...
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parameters

private Map<String,List<String>> parameters
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

getKeys

public Set<String> getKeys()
Get all keys that are present in the query string.

Returns:
A set with the keys

2.17.2: 2011-06-17