Class Cookies

java.lang.Object
io.undertow.util.Cookies

public class Cookies extends Object
Class that contains utility methods for dealing with cookies.
Author:
Stuart Douglas, Andre Dietisheim, Richard Opalka
  • Field Details

  • Method Details

    • parseSetCookieHeader

      public static Cookie parseSetCookieHeader(String headerValue)
      Parses a "Set-Cookie:" response header value into its cookie representation. The header value is parsed according to the syntax that's defined in RFC2109:
       
        set-cookie      =       "Set-Cookie:" cookies
         cookies         =       1#cookie
         cookie          =       NAME "=" VALUE *(";" cookie-av)
         NAME            =       attr
         VALUE           =       value
         cookie-av       =       "Comment" "=" value
                         |       "Domain" "=" value
                         |       "Max-Age" "=" value
                         |       "Path" "=" value
                         |       "Secure"
                         |       "Version" "=" 1*DIGIT
      
       
       
      Parameters:
      headerValue - The header value
      Returns:
      The cookie
      See Also:
    • parseRequestCookies

      @Deprecated(since="2.2.0", forRemoval=true) public static Map<String,Cookie> parseRequestCookies(int maxCookies, boolean allowEqualInValue, List<String> cookies)
      Deprecated, for removal: This API element is subject to removal in a future version.
      /** Parses the cookies from a list of "Cookie:" header values. The cookie header values are parsed according to RFC2109 that defines the following syntax:
       
       cookie          =  "Cookie:" cookie-version
                          1*((";" | ",") cookie-value)
       cookie-value    =  NAME "=" VALUE [";" path] [";" domain]
       cookie-version  =  "$Version" "=" value
       NAME            =  attr
       VALUE           =  value
       path            =  "$Path" "=" value
       domain          =  "$Domain" "=" value
       
       
      Parameters:
      maxCookies - The maximum number of cookies. Used to prevent hash collision attacks
      allowEqualInValue - if true equal characters are allowed in cookie values
      cookies - The cookie values to parse
      Returns:
      A pared cookie map
      See Also:
    • parseRequestCookies

      @Deprecated(since="2.4.0", forRemoval=true) public static void parseRequestCookies(int maxCookies, boolean allowEqualInValue, List<String> cookies, Set<Cookie> parsedCookies)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • parseRequestCookies

      public static void parseRequestCookies(List<String> cookies, CookieStore requestCookieStore, org.xnio.OptionMap options)
    • assembleCrumbs

      public static void assembleCrumbs(HeaderMap headerMap)
      Cookie headers form: https://www.rfc-editor.org/rfc/rfc6265#section-4.2.1 If more than one header entry exist for "Cookie", it will be assembled into one that conforms to rfc.
      Parameters:
      headerMap -
    • disperseCrumbs

      public static void disperseCrumbs(HeaderMap headerMap)
      IF there is single entry that follows RFC separation rules, it will be turned into singular fields. This should be only used PRIOR to compression.
      Parameters:
      headerMap -
    • getCrumbs

      public static List<String> getCrumbs(HeaderMap headerMap)
      Fetch list containing crumbs( singular entries of Cookie header )
      Parameters:
      headerMap -
      Returns:
    • isCrumbsAssemplyDisabled

      public static boolean isCrumbsAssemplyDisabled()