Class QueryStringParser


  • public class QueryStringParser
    extends Object
    Parser for URL query strings.
    • Constructor Detail

      • QueryStringParser

        public QueryStringParser​(String queryString)
        Construct a parser from the given URL query string.
        Parameters:
        queryString - the query string, i.e. the part of the URL starting after the '?' character
    • Method Detail

      • next

        public boolean next()
        Move to the next parameter in the query string.
        Returns:
        true if a parameter has been found; false if there are no more parameters
      • search

        public boolean search​(Collection<String> names)
        Search for a parameter with a name in a given collection. This method iterates over the parameters until a parameter with a matching name has been found. Note that the current parameter is not considered.
        Parameters:
        names -
        Returns:
      • getName

        public String getName()
        Get the name of the current parameter. Calling this method is only allowed if next() has been called previously and the result of this call was true. Otherwise the result of this method is undefined.
        Returns:
        the name of the current parameter
      • getValue

        public String getValue()
        Get the value of the current parameter. Calling this method is only allowed if next() has been called previously and the result of this call was true. Otherwise the result of this method is undefined.
        Returns:
        the decoded value of the current parameter