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 Details

  • Constructor Details

    • QueryParameters

      private QueryParameters(String query)
  • Method Details

    • 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