RFC2109Spec (HttpClient Library (Version 3.1))
Date: 2019-01-01

org.apache.commons.httpclient.cookie

## Class RFC2109Spec

- java.lang.Object
- - org.apache.commons.httpclient.cookie.CookieSpecBase
  - - org.apache.commons.httpclient.cookie.RFC2109Spec

- All Implemented Interfaces:
    CookieSpec

      public class RFC2109Spec
      extends CookieSpecBase

  RFC 2109 specific cookie management functions

  Since:
    2.0
  Author:
    B.C. Holmes, Park, Sung-Gu, Doug Sale, Rod Waldhoff, dIon Gillard, Sean C. Sullivan, John Evans, Marc A. Saegesser, Oleg Kalnichevski, Mike Bowler

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `SET_COOKIE_KEY` Cookie Response Header name for cookies processed by this spec.

    - ### Fields inherited from class org.apache.commons.httpclient.cookie.CookieSpecBase

      `LOG`

    - ### Fields inherited from interface org.apache.commons.httpclient.cookie.CookieSpec

      `PATH_DELIM, PATH_DELIM_CHAR`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RFC2109Spec()` Default constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `domainMatch(java.lang.String host, java.lang.String domain)` Performs domain-match as defined by the RFC2109.
    `java.lang.String` | `formatCookie(Cookie cookie)` Return a string suitable for sending in a `"Cookie"` header as defined in RFC 2109
    `java.lang.String` | `formatCookies(Cookie[] cookies)` Create a RFC 2109 compliant `"Cookie"` header value containing all `Cookie`s in cookies suitable for sending in a `"Cookie"` header
    `void` | `parseAttribute(NameValuePair attribute, Cookie cookie)` Parse RFC 2109 specific cookie attribute and update the corresponsing `Cookie` properties.
    `void` | `validate(java.lang.String host, int port, java.lang.String path, boolean secure, Cookie cookie)` Performs RFC 2109 compliant `Cookie` validation

    - ### Methods inherited from class org.apache.commons.httpclient.cookie.CookieSpecBase

      `formatCookieHeader, formatCookieHeader, getValidDateFormats, match, match, parse, parse, pathMatch, setValidDateFormats`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### SET_COOKIE_KEY

          public static final java.lang.String SET_COOKIE_KEY

      Cookie Response Header name for cookies processed by this spec.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### RFC2109Spec

          public RFC2109Spec()

      Default constructor

  - ### Method Detail

    - #### parseAttribute

          public void parseAttribute(NameValuePair attribute,
                                     Cookie cookie)
                              throws MalformedCookieException

      Parse RFC 2109 specific cookie attribute and update the corresponsing `Cookie` properties.
      Specified by:
        `parseAttribute` in interface `CookieSpec`
      Overrides:
        `parseAttribute` in class `CookieSpecBase`
      Parameters:
        `attribute` - `NameValuePair` cookie attribute from the `Set- Cookie`
        `cookie` - `Cookie` to be updated
      Throws:
        `MalformedCookieException` - if an exception occurs during parsing

    - #### validate

          public void validate(java.lang.String host,
                               int port,
                               java.lang.String path,
                               boolean secure,
                               Cookie cookie)
                        throws MalformedCookieException

      Performs RFC 2109 compliant `Cookie` validation
      Specified by:
        `validate` in interface `CookieSpec`
      Overrides:
        `validate` in class `CookieSpecBase`
      Parameters:
        `host` - the host from which the `Cookie` was received
        `port` - the port from which the `Cookie` was received
        `path` - the path from which the `Cookie` was received
        `secure` - `true` when the `Cookie` was received using a secure connection
        `cookie` - The cookie to validate
      Throws:
        `MalformedCookieException` - if an exception occurs during validation

    - #### domainMatch

          public boolean domainMatch(java.lang.String host,
                                     java.lang.String domain)

      Performs domain-match as defined by the RFC2109.
      Specified by:
        `domainMatch` in interface `CookieSpec`
      Overrides:
        `domainMatch` in class `CookieSpecBase`
      Parameters:
        `host` - The target host.
        `domain` - The cookie domain attribute.
      Returns:
        true if the specified host matches the given domain.
      Since:
        3.0

    - #### formatCookie

          public java.lang.String formatCookie(Cookie cookie)

      Return a string suitable for sending in a `"Cookie"` header as defined in RFC 2109
      Specified by:
        `formatCookie` in interface `CookieSpec`
      Overrides:
        `formatCookie` in class `CookieSpecBase`
      Parameters:
        `cookie` - a `Cookie` to be formatted as string
      Returns:
        a string suitable for sending in a `"Cookie"` header.

    - #### formatCookies

          public java.lang.String formatCookies(Cookie[] cookies)

      Create a RFC 2109 compliant `"Cookie"` header value containing all `Cookie`s in cookies suitable for sending in a `"Cookie"` header
      Specified by:
        `formatCookies` in interface `CookieSpec`
      Overrides:
        `formatCookies` in class `CookieSpecBase`
      Parameters:
        `cookies` - an array of `Cookie`s to be formatted
      Returns:
        a string suitable for sending in a Cookie header.

Copyright (c) 1999-2005 - Apache Software Foundation