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 anIteratorthat 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 privateSequence()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhasNext()Determine whether or not there are anyCookies left in theString.Cookienext()Extracts the nextCookieobject from the string given.voidremove()This method is used to remove items from the iterator.
-
-
-
Method Detail
-
next
public Cookie next()
Extracts the nextCookieobject from the string given. This will returnnullwhen there are no more cookies left in theStringbeing parsed.To find out when there are no more cookies left use the
hasNextmethod. This will only set the name, value, path, domain name version of thecookiebecause as of RFC 2109 these are the only attributes aCookiemay have, the path and domain are optional.- Specified by:
nextin interfacejava.util.Iterator<Cookie>- Returns:
- an initialized
Cookieobject
-
hasNext
public boolean hasNext()
Determine whether or not there are anyCookies left in theString. This will attempt to extract anotherCookiefrom theStringand cache the result so thenextmethod will produce thisCookie. If anotherCookiecannot be parsed from the remainder of theStringthen this will returnfalseotherwise it will returntrue.- Specified by:
hasNextin 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 theresetmethod and used again.- Specified by:
removein interfacejava.util.Iterator<Cookie>
-
-