Class CookieParserUtils


  • public class CookieParserUtils
    extends Object
    The set of Cookie utility methods for cookie parsing. There is duplication of logic within which we know to be frowned upon, however it is done with performance in mind.
    Author:
    Grizzly team
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void parseClientCookies​(Cookies cookies, byte[] bytes, int off, int len)
      Parses a cookie header after the initial "Cookie:" [WS][$]token[WS]=[WS](token|QV)[;|,] RFC 2965 JVK
      static void parseClientCookies​(Cookies cookies, byte[] bytes, int off, int len, boolean versionOneStrictCompliance, boolean rfc6265Enabled)
      Parses a cookie header after the initial "Cookie:" [WS][$]token[WS]=[WS](token|QV)[;|,] RFC 2965 JVK
      static void parseClientCookies​(Cookies cookies, String cookiesStr, boolean versionOneStrictCompliance, boolean rfc6265Enabled)
      Parses a cookie header after the initial "Cookie:" [WS][$]token[WS]=[WS](token|QV)[;|,] RFC 2965 JVK
      static void parseClientCookies​(Cookies cookies, org.glassfish.grizzly.Buffer buffer, int off, int len)
      Parses a cookie header after the initial "Cookie:" [WS][$]token[WS]=[WS](token|QV)[;|,] RFC 2965 JVK
      static void parseClientCookies​(Cookies cookies, org.glassfish.grizzly.Buffer buffer, int off, int len, boolean versionOneStrictCompliance, boolean rfc6265Enabled)
      Parses a cookie header after the initial "Cookie:" [WS][$]token[WS]=[WS](token|QV)[;|,] RFC 2965 JVK
      static void parseServerCookies​(Cookies cookies, byte[] bytes, int off, int len, boolean versionOneStrictCompliance, boolean rfc6265Enabled)  
      static void parseServerCookies​(Cookies cookies, String cookiesStr, boolean versionOneStrictCompliance, boolean rfc6265Enabled)  
      static void parseServerCookies​(Cookies cookies, org.glassfish.grizzly.Buffer buffer, int off, int len, boolean versionOneStrictCompliance, boolean rfc6265Enabled)  
      static String unescapeDoubleQuotes​(String s, int start, int length)
      Unescapes any double quotes in the given cookie value.
      static int unescapeDoubleQuotes​(org.glassfish.grizzly.Buffer buffer, int start, int length)
      Un-escapes any double quotes in the given cookie value.
      static void unescapeDoubleQuotes​(BufferChunk bc)
      Unescapes any double quotes in the given cookie value.
      static void unescapeDoubleQuotes​(ByteChunk bc)
      Unescapes any double quotes in the given cookie value.
      static void unescapeDoubleQuotes​(CharChunk cc)
      Unescapes any double quotes in the given cookie value.
      static void unescapeDoubleQuotes​(DataChunk dc)
      Unescapes any double quotes in the given cookie value.
    • Constructor Detail

      • CookieParserUtils

        public CookieParserUtils()
    • Method Detail

      • parseClientCookies

        public static void parseClientCookies​(Cookies cookies,
                                              org.glassfish.grizzly.Buffer buffer,
                                              int off,
                                              int len)
        Parses a cookie header after the initial "Cookie:" [WS][$]token[WS]=[WS](token|QV)[;|,] RFC 2965 JVK
      • parseClientCookies

        public static void parseClientCookies​(Cookies cookies,
                                              org.glassfish.grizzly.Buffer buffer,
                                              int off,
                                              int len,
                                              boolean versionOneStrictCompliance,
                                              boolean rfc6265Enabled)
        Parses a cookie header after the initial "Cookie:" [WS][$]token[WS]=[WS](token|QV)[;|,] RFC 2965 JVK
      • parseClientCookies

        public static void parseClientCookies​(Cookies cookies,
                                              byte[] bytes,
                                              int off,
                                              int len)
        Parses a cookie header after the initial "Cookie:" [WS][$]token[WS]=[WS](token|QV)[;|,] RFC 2965 JVK
      • parseClientCookies

        public static void parseClientCookies​(Cookies cookies,
                                              byte[] bytes,
                                              int off,
                                              int len,
                                              boolean versionOneStrictCompliance,
                                              boolean rfc6265Enabled)
        Parses a cookie header after the initial "Cookie:" [WS][$]token[WS]=[WS](token|QV)[;|,] RFC 2965 JVK
      • parseClientCookies

        public static void parseClientCookies​(Cookies cookies,
                                              String cookiesStr,
                                              boolean versionOneStrictCompliance,
                                              boolean rfc6265Enabled)
        Parses a cookie header after the initial "Cookie:" [WS][$]token[WS]=[WS](token|QV)[;|,] RFC 2965 JVK
      • parseServerCookies

        public static void parseServerCookies​(Cookies cookies,
                                              byte[] bytes,
                                              int off,
                                              int len,
                                              boolean versionOneStrictCompliance,
                                              boolean rfc6265Enabled)
      • parseServerCookies

        public static void parseServerCookies​(Cookies cookies,
                                              org.glassfish.grizzly.Buffer buffer,
                                              int off,
                                              int len,
                                              boolean versionOneStrictCompliance,
                                              boolean rfc6265Enabled)
      • parseServerCookies

        public static void parseServerCookies​(Cookies cookies,
                                              String cookiesStr,
                                              boolean versionOneStrictCompliance,
                                              boolean rfc6265Enabled)
      • unescapeDoubleQuotes

        public static void unescapeDoubleQuotes​(DataChunk dc)
        Unescapes any double quotes in the given cookie value.
        Parameters:
        dc - The cookie value to modify
      • unescapeDoubleQuotes

        public static void unescapeDoubleQuotes​(ByteChunk bc)
        Unescapes any double quotes in the given cookie value.
        Parameters:
        bc - The cookie value to modify
      • unescapeDoubleQuotes

        public static void unescapeDoubleQuotes​(BufferChunk bc)
        Unescapes any double quotes in the given cookie value.
        Parameters:
        bc - The cookie value to modify
      • unescapeDoubleQuotes

        public static void unescapeDoubleQuotes​(CharChunk cc)
        Unescapes any double quotes in the given cookie value.
        Parameters:
        cc - The cookie value to modify
      • unescapeDoubleQuotes

        public static int unescapeDoubleQuotes​(org.glassfish.grizzly.Buffer buffer,
                                               int start,
                                               int length)
        Un-escapes any double quotes in the given cookie value.
        Parameters:
        buffer - the cookie buffer.
        start - start position.
        length - number of bytes to un-escape.
        Returns:
        new length
      • unescapeDoubleQuotes

        public static String unescapeDoubleQuotes​(String s,
                                                  int start,
                                                  int length)
        Unescapes any double quotes in the given cookie value.
        Parameters:
        s - The cookie value to modify
        Returns:
        new String