Package org.restlet.engine.header
Class CookieWriter
- java.lang.Object
-
- java.io.Writer
-
- java.io.StringWriter
-
- org.restlet.engine.header.HeaderWriter<Cookie>
-
- org.restlet.engine.header.CookieWriter
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.Appendable,java.lang.AutoCloseable
public class CookieWriter extends HeaderWriter<Cookie>
Cookie header writer.
-
-
Constructor Summary
Constructors Constructor Description CookieWriter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CookieWriterappend(java.util.List<Cookie> cookies)Appends a list of cookies as an HTTP header.CookieWriterappend(Cookie cookie)Appends a value.CookieWriterappendValue(java.lang.String value, int version)Appends a source string as an HTTP comment.static voidgetCookies(java.util.List<Cookie> source, java.util.Map<java.lang.String,Cookie> destination)Gets the cookies whose name is a key in the given map.static java.lang.Stringwrite(java.util.List<Cookie> cookies)Writes a cookie.static java.lang.Stringwrite(Cookie cookie)Writes a cookie.-
Methods inherited from class org.restlet.engine.header.HeaderWriter
append, append, append, append, append, append, appendComment, appendExtension, appendExtension, appendParameterSeparator, appendProduct, appendQuotedPair, appendQuotedString, appendSpace, appendToken, appendUriEncoded, appendValueSeparator, canWrite
-
-
-
-
Method Detail
-
getCookies
public static void getCookies(java.util.List<Cookie> source, java.util.Map<java.lang.String,Cookie> destination)
Gets the cookies whose name is a key in the given map. If a matching cookie is found, its value is put in the map.- Parameters:
source- The source list of cookies.destination- The cookies map controlling the reading.
-
write
public static java.lang.String write(Cookie cookie) throws java.lang.IllegalArgumentException
Writes a cookie.- Parameters:
cookie- The cookie to format.- Returns:
- The formatted cookie.
- Throws:
java.lang.IllegalArgumentException- If the Cookie contains illegal values.
-
write
public static java.lang.String write(java.util.List<Cookie> cookies)
Writes a cookie.- Parameters:
cookies- The cookies to format.- Returns:
- The formatted cookie.
-
append
public CookieWriter append(Cookie cookie) throws java.lang.IllegalArgumentException
Description copied from class:HeaderWriterAppends a value.- Specified by:
appendin classHeaderWriter<Cookie>- Parameters:
cookie- The value.- Returns:
- This writer.
- Throws:
java.lang.IllegalArgumentException
-
append
public CookieWriter append(java.util.List<Cookie> cookies)
Appends a list of cookies as an HTTP header.- Parameters:
cookies- The list of cookies to format.- Returns:
- This writer.
-
appendValue
public CookieWriter appendValue(java.lang.String value, int version)
Appends a source string as an HTTP comment.- Parameters:
value- The source string to format.version- The cookie version.- Returns:
- This writer.
-
-