Class HtmlUnitBrowserCompatCookieSpec

  • All Implemented Interfaces:
    org.apache.http.cookie.CookieSpec

    public class HtmlUnitBrowserCompatCookieSpec
    extends org.apache.http.impl.cookie.CookieSpecBase
    Customized BrowserCompatSpec for HtmlUnit.

    Workaround for HttpClient bug 1006: quotes are wrongly removed in cookie's values. Implementation is based on the HttpClient code.

    • Field Detail

      • EMPTY_COOKIE_NAME

        public static final java.lang.String EMPTY_COOKIE_NAME
        The cookie name used for cookies with no name (HttpClient doesn't like empty names).
        See Also:
        Constant Field Values
      • LOCAL_FILESYSTEM_DOMAIN

        public static final java.lang.String LOCAL_FILESYSTEM_DOMAIN
        Workaround for domain of local files.
        See Also:
        Constant Field Values
      • COOKIE_COMPARATOR

        private static final java.util.Comparator<org.apache.http.cookie.Cookie> COOKIE_COMPARATOR
        Comparator for sending cookies in right order. See specification: - RFC2109 (#4.3.4) http://www.ietf.org/rfc/rfc2109.txt - RFC2965 (#3.3.4) http://www.ietf.org/rfc/rfc2965.txt http://www.ietf.org/rfc/rfc2109.txt
      • DATE_1_1_1970

        static final java.util.Date DATE_1_1_1970
    • Constructor Detail

      • HtmlUnitBrowserCompatCookieSpec

        public HtmlUnitBrowserCompatCookieSpec​(BrowserVersion browserVersion)
        Constructor.
        Parameters:
        browserVersion - the BrowserVersion to simulate
    • Method Detail

      • parse

        public java.util.List<org.apache.http.cookie.Cookie> parse​(org.apache.http.Header header,
                                                                   org.apache.http.cookie.CookieOrigin origin)
                                                            throws org.apache.http.cookie.MalformedCookieException
        Throws:
        org.apache.http.cookie.MalformedCookieException
      • formatCookies

        public java.util.List<org.apache.http.Header> formatCookies​(java.util.List<org.apache.http.cookie.Cookie> cookies)
      • isQuoteEnclosed

        private static boolean isQuoteEnclosed​(java.lang.String s)
      • getVersion

        public int getVersion()
      • getVersionHeader

        public org.apache.http.Header getVersionHeader()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object