org.restlet.engine.header
Class CookieWriter

java.lang.Object
  extended by java.io.Writer
      extended by java.io.StringWriter
          extended by org.restlet.engine.header.HeaderWriter<Cookie>
              extended by org.restlet.engine.header.CookieWriter
All Implemented Interfaces:
Closeable, Flushable, Appendable

public class CookieWriter
extends HeaderWriter<Cookie>

Cookie header writer.

Author:
Jerome Louvel

Field Summary
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
CookieWriter()
           
 
Method Summary
 CookieWriter append(Cookie cookie)
          Appends a value.
 CookieWriter append(List<Cookie> cookies)
          Appends a list of cookies as an HTTP header.
 CookieWriter appendValue(String value, int version)
          Appends a source string as an HTTP comment.
static void getCookies(List<Cookie> source, Map<String,Cookie> destination)
          Gets the cookies whose name is a key in the given map.
static String write(Cookie cookie)
          Writes a cookie.
static String write(List<Cookie> cookies)
          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
 
Methods inherited from class java.io.StringWriter
append, close, flush, getBuffer, toString, write, write, write, write
 
Methods inherited from class java.io.Writer
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CookieWriter

public CookieWriter()
Method Detail

getCookies

public static void getCookies(List<Cookie> source,
                              Map<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 String write(Cookie cookie)
                    throws IllegalArgumentException
Writes a cookie.

Parameters:
cookie - The cookie to format.
Returns:
The formatted cookie.
Throws:
IllegalArgumentException - If the Cookie contains illegal values.

write

public static String write(List<Cookie> cookies)
Writes a cookie.

Parameters:
cookies - The cookies to format.
Returns:
The formatted cookie.

append

public CookieWriter append(Cookie cookie)
                    throws IllegalArgumentException
Description copied from class: HeaderWriter
Appends a value.

Specified by:
append in class HeaderWriter<Cookie>
Parameters:
cookie - The value.
Returns:
This writer.
Throws:
IllegalArgumentException

append

public CookieWriter append(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(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.


Copyright © 2005-2013 Restlet.