Class RFC2965Spec
java.lang.Object
org.apache.commons.httpclient.cookie.CookieSpecBase
org.apache.commons.httpclient.cookie.RFC2965Spec
- All Implemented Interfaces:
CookieSpec
,CookieVersionSupport
Deprecated.
Jakarta Commons HttpClient 3.x is deprecated in the Jenkins project.
It is not recommended to use it in any new code.
Instead, use HTTP client API plugins as a dependency in your code.
E.g.
Apache HttpComponents Client API 4.x Plugin or
Async HTTP Client Plugin.
RFC 2965 specific cookie management functions.
- Since:
- 3.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Deprecated.Cookie Response Header name for cookies processed by this spec.Fields inherited from interface org.apache.commons.httpclient.cookie.CookieSpec
PATH_DELIM, PATH_DELIM_CHAR
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
domainMatch
(String host, String domain) Deprecated.Performs domain-match as defined by the RFC2965.formatCookie
(Cookie cookie) Deprecated.Return a string suitable for sending in a "Cookie" header as defined in RFC 2965formatCookies
(Cookie[] cookies) Deprecated.Create a RFC 2965 compliant "Cookie" header value containing allCookie
s suitable for sending in a "Cookie" headerint
Deprecated.Deprecated.boolean
Deprecated.Return true if the cookie should be submitted with a request with given attributes, false otherwise.Cookie[]
Deprecated.Parses the Set-Cookie value into an array of Cookies.Cookie[]
Deprecated.Parses the Set-Cookie2 value into an array of Cookies.void
parseAttribute
(NameValuePair attribute, Cookie cookie) Deprecated.Parse RFC 2965 specific cookie attribute and update the corresponsingCookie
properties.void
Deprecated.Performs RFC 2965 compliantCookie
validationMethods inherited from class org.apache.commons.httpclient.cookie.CookieSpecBase
formatCookieHeader, formatCookieHeader, getValidDateFormats, match, pathMatch, setValidDateFormats
-
Field Details
-
SET_COOKIE2_KEY
Deprecated.Cookie Response Header name for cookies processed by this spec.- See Also:
-
-
Constructor Details
-
RFC2965Spec
public RFC2965Spec()Deprecated.Default constructor
-
-
Method Details
-
parse
public Cookie[] parse(String host, int port, String path, boolean secure, Header header) throws MalformedCookieException Deprecated.Parses the Set-Cookie2 value into an array of Cookies.The syntax for the Set-Cookie2 response header is:
set-cookie = "Set-Cookie2:" cookies cookies = 1#cookie cookie = NAME "=" VALUE * (";" cookie-av) NAME = attr VALUE = value cookie-av = "Comment" "=" value | "CommentURL" "=" invalid input: '<'"> http_URL invalid input: '<'"> | "Discard" | "Domain" "=" value | "Max-Age" "=" value | "Path" "=" value | "Port" [ "=" invalid input: '<'"> portlist invalid input: '<'"> ] | "Secure" | "Version" "=" 1*DIGIT portlist = 1#portnum portnum = 1*DIGIT
- Specified by:
parse
in interfaceCookieSpec
- Overrides:
parse
in classCookieSpecBase
- Parameters:
host
- the host from which the Set-Cookie2 value was receivedport
- the port from which the Set-Cookie2 value was receivedpath
- the path from which the Set-Cookie2 value was receivedsecure
- true when the Set-Cookie2 value was received over secure conectionheader
- the Set-Cookie2 Header received from the server- Returns:
- an array of Cookies parsed from the Set-Cookie2 value
- Throws:
MalformedCookieException
- if an exception occurs during parsing- See Also:
-
parse
public Cookie[] parse(String host, int port, String path, boolean secure, String header) throws MalformedCookieException Deprecated.Description copied from class:CookieSpecBase
Parses the Set-Cookie value into an array of Cookies.The syntax for the Set-Cookie response header is:
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
- Specified by:
parse
in interfaceCookieSpec
- Overrides:
parse
in classCookieSpecBase
- Parameters:
host
- the host from which the Set-Cookie value was receivedport
- the port from which the Set-Cookie value was receivedpath
- the path from which the Set-Cookie value was receivedsecure
- true when the Set-Cookie value was received over secure conectionheader
- the Set-Cookie received from the server- Returns:
- an array of Cookies parsed from the Set-Cookie value
- Throws:
MalformedCookieException
- if an exception occurs during parsing- See Also:
-
parseAttribute
Deprecated.Parse RFC 2965 specific cookie attribute and update the corresponsingCookie
properties.- Specified by:
parseAttribute
in interfaceCookieSpec
- Overrides:
parseAttribute
in classCookieSpecBase
- Parameters:
attribute
-NameValuePair
cookie attribute from the Set-Cookie2 header.cookie
-Cookie
to be updated- Throws:
MalformedCookieException
- if an exception occurs during parsing
-
validate
public void validate(String host, int port, String path, boolean secure, Cookie cookie) throws MalformedCookieException Deprecated.Performs RFC 2965 compliantCookie
validation- Specified by:
validate
in interfaceCookieSpec
- Overrides:
validate
in classCookieSpecBase
- Parameters:
host
- the host from which theCookie
was receivedport
- the port from which theCookie
was receivedpath
- the path from which theCookie
was receivedsecure
- true when theCookie
was received using a secure connectioncookie
- The cookie to validate- Throws:
MalformedCookieException
- if an exception occurs during validation
-
match
Deprecated.Return true if the cookie should be submitted with a request with given attributes, false otherwise.- Specified by:
match
in interfaceCookieSpec
- Overrides:
match
in classCookieSpecBase
- Parameters:
host
- the host to which the request is being submittedport
- the port to which the request is being submitted (ignored)path
- the path to which the request is being submittedsecure
- true if the request is using a secure connectioncookie
-Cookie
to be matched- Returns:
- true if the cookie matches the criterium
-
formatCookie
Deprecated.Return a string suitable for sending in a "Cookie" header as defined in RFC 2965- Specified by:
formatCookie
in interfaceCookieSpec
- Overrides:
formatCookie
in classCookieSpecBase
- Parameters:
cookie
- aCookie
to be formatted as string- Returns:
- a string suitable for sending in a "Cookie" header.
-
formatCookies
Deprecated.Create a RFC 2965 compliant "Cookie" header value containing allCookie
s suitable for sending in a "Cookie" header- Specified by:
formatCookies
in interfaceCookieSpec
- Overrides:
formatCookies
in classCookieSpecBase
- Parameters:
cookies
- an array ofCookie
s to be formatted- Returns:
- a string suitable for sending in a Cookie header.
-
domainMatch
Deprecated.Performs domain-match as defined by the RFC2965.Host A's name domain-matches host B's if
- their host name strings string-compare equal; or
- A is a HDN string and has the form NB, where N is a non-empty
name string, B has the form .B', and B' is a HDN string. (So,
x.y.com domain-matches .Y.com but not Y.com.)
- Specified by:
domainMatch
in interfaceCookieSpec
- Overrides:
domainMatch
in classCookieSpecBase
- Parameters:
host
- host name where cookie is received from or being sent to.domain
- The cookie domain attribute.- Returns:
- true if the specified host matches the given domain.
-
getVersion
public int getVersion()Deprecated.- Specified by:
getVersion
in interfaceCookieVersionSupport
-
getVersionHeader
Deprecated.- Specified by:
getVersionHeader
in interfaceCookieVersionSupport
-