Class CookieWriter

All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable

public class CookieWriter extends HeaderWriter<Cookie>
Cookie header writer.
Author:
Jerome Louvel
  • Constructor Details

    • CookieWriter

      public CookieWriter()
  • Method Details

    • 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.