Class CookieParser.Sequence

java.lang.Object
org.simpleframework.http.parse.CookieParser.Sequence
All Implemented Interfaces:
Iterator<Cookie>
Enclosing class:
CookieParser

private class CookieParser.Sequence extends Object implements Iterator<Cookie>
This is used to represent an Iterator that will iterate over the available cookies within the provided source text. This allows the cookie parser to be used as an iterable with for each loops. Cookies can not be removed with this.
  • Constructor Details

    • Sequence

      private Sequence()
  • Method Details

    • next

      public Cookie next()
      Extracts the next Cookie object from the string given. This will return null when there are no more cookies left in the String being parsed.

      To find out when there are no more cookies left use the hasNext method. This will only set the name, value, path, domain name version of the cookie because as of RFC 2109 these are the only attributes a Cookie may have, the path and domain are optional.

      Specified by:
      next in interface Iterator<Cookie>
      Returns:
      an initialized Cookie object
    • hasNext

      public boolean hasNext()
      Determine whether or not there are any Cookies left in the String. This will attempt to extract another Cookie from the String and cache the result so the next method will produce this Cookie. If another Cookie cannot be parsed from the remainder of the String then this will return false otherwise it will return true.
      Specified by:
      hasNext in interface Iterator<Cookie>
      Returns:
      true if there are more cookies false otherwise
    • remove

      public void remove()
      This method is used to remove items from the iterator. This however performs no action as the act of parsing should not modify the underlying source text value so that it can be reset with the reset method and used again.
      Specified by:
      remove in interface Iterator<Cookie>