Class 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 Detail

      • CookieWriter

        public CookieWriter()
    • 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: HeaderWriter
        Appends a value.
        Specified by:
        append in class HeaderWriter<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.