Class SplitCookieService

java.lang.Object
org.forgerock.openig.cookie.SplitCookieService

public final class SplitCookieService extends Object
Split a target cookie that is bigger than 4Kb (see RFC 6265) into smaller cookies.

If the tracked cookie is too big, it is replaced by several cookies named [originalCookieName][partNumber].

If a tracked split cookie is found in a request, it is reassembled transparently.

If the cookie name maps multiple cookies, only the first one will be taken into account.

For example, if the tracked cookie is named "myCookie" and is 10Kb long, then it will be split into 3 cookies named : "myCookie0", "myCookie1" and "myCookie2", the 2 first weighting 4Kb and the last 2Kb.

  • Constructor Details

    • SplitCookieService

      public SplitCookieService(String cookieName)
      Create a new SplitCookieService that will split/assemble the cookie with the given name.
      Parameters:
      cookieName - the name of the cookie to split/assemble
  • Method Details

    • assembleSplitRequestCookies

      public int assembleSplitRequestCookies(Headers requestHeaders)
      Assemble the split cookies into a single cookie (if any).
      Parameters:
      requestHeaders - the request headers
      Returns:
      the number of parts gathered
    • splitResponseCookie

      public void splitResponseCookie(int previousPartCount, Headers responseHeaders)
      Split the response cookie if it is too big.
      Parameters:
      previousPartCount - the number of parts gathered in the request
      responseHeaders - the response headers