Package org.simpleframework.http.parse
Class CookieParser.Sequence
- java.lang.Object
-
- org.simpleframework.http.parse.CookieParser.Sequence
-
- All Implemented Interfaces:
java.util.Iterator<Cookie>
- Enclosing class:
- CookieParser
private class CookieParser.Sequence extends java.lang.Object implements java.util.Iterator<Cookie>
This is used to represent anIterator
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 Summary
Constructors Modifier Constructor Description private
Sequence()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
Determine whether or not there are anyCookie
s left in theString
.Cookie
next()
Extracts the nextCookie
object from the string given.void
remove()
This method is used to remove items from the iterator.
-
-
-
Method Detail
-
next
public Cookie next()
Extracts the nextCookie
object from the string given. This will returnnull
when there are no more cookies left in theString
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 thecookie
because as of RFC 2109 these are the only attributes aCookie
may have, the path and domain are optional.- Specified by:
next
in interfacejava.util.Iterator<Cookie>
- Returns:
- an initialized
Cookie
object
-
hasNext
public boolean hasNext()
Determine whether or not there are anyCookie
s left in theString
. This will attempt to extract anotherCookie
from theString
and cache the result so thenext
method will produce thisCookie
. If anotherCookie
cannot be parsed from the remainder of theString
then this will returnfalse
otherwise it will returntrue
.- Specified by:
hasNext
in interfacejava.util.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 thereset
method and used again.- Specified by:
remove
in interfacejava.util.Iterator<Cookie>
-
-