Class CookieSpecBase
java.lang.Object
org.apache.commons.httpclient.cookie.CookieSpecBase
- All Implemented Interfaces:
CookieSpec
- Direct Known Subclasses:
NetscapeDraftSpec
,RFC2109Spec
,RFC2965Spec
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.
Cookie management functions shared by all specification.
- Since:
- 2.0
-
Field Summary
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 implemented in common browsers.formatCookie
(Cookie cookie) Deprecated.Return a string suitable for sending in a "Cookie" headerformatCookieHeader
(Cookie cookie) formatCookieHeader
(Cookie[] cookies) formatCookies
(Cookie[] cookies) Deprecated.Create a "Cookie" header value containing allCookie
s in cookies suitable for sending in a "Cookie" headerDeprecated.Returns theCollection
of date patterns used for parsing.boolean
Deprecated.Return true if the cookie should be submitted with a request with given attributes, false otherwise.Cookie[]
Deprecated.Return an array ofCookie
s that should be submitted with a request with given attributes, false otherwise.Cookie[]
Deprecated.Parses the Set-Cookie value into an array of Cookies.Cookie[]
void
parseAttribute
(NameValuePair attribute, Cookie cookie) Deprecated.Parse the cookie attribute and update the corresponsingCookie
properties.boolean
Deprecated.Performs path-match as implemented in common browsers.void
setValidDateFormats
(Collection datepatterns) Deprecated.Sets theCollection
of date patterns used for parsing.void
Deprecated.Performs most commonCookie
validation
-
Constructor Details
-
CookieSpecBase
public CookieSpecBase()Deprecated.Default constructor
-
-
Method Details
-
parse
public Cookie[] parse(String host, int port, String path, boolean secure, String header) throws MalformedCookieException Deprecated.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
- 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:
-
parse
public Cookie[] parse(String host, int port, String path, boolean secure, Header header) throws MalformedCookieException Deprecated.Parse the "Set-Cookie"Header
into an array ofCookie
s.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
- Parameters:
host
- the host from which the Set-Cookie header was receivedport
- the port from which the Set-Cookie header was receivedpath
- the path from which the Set-Cookie header was receivedsecure
- true when the Set-Cookie header was received over secure conectionheader
- the Set-Cookie received from the server- Returns:
- an array of Cookies parsed from the "Set-Cookie" header
- Throws:
MalformedCookieException
- if an exception occurs during parsing- See Also:
-
parseAttribute
Deprecated.Parse the cookie attribute and update the corresponsingCookie
properties.- Specified by:
parseAttribute
in interfaceCookieSpec
- Parameters:
attribute
-HeaderElement
cookie attribute from the Set- Cookiecookie
-Cookie
to be updated- Throws:
MalformedCookieException
- if an exception occurs during parsing
-
getValidDateFormats
Deprecated.Description copied from interface:CookieSpec
Returns theCollection
of date patterns used for parsing. The String patterns are compatible with theSimpleDateFormat
.- Specified by:
getValidDateFormats
in interfaceCookieSpec
- Returns:
- collection of date patterns
-
setValidDateFormats
Deprecated.Description copied from interface:CookieSpec
Sets theCollection
of date patterns used for parsing. The String patterns must be compatible withSimpleDateFormat
.- Specified by:
setValidDateFormats
in interfaceCookieSpec
- Parameters:
datepatterns
- collection of date patterns
-
validate
public void validate(String host, int port, String path, boolean secure, Cookie cookie) throws MalformedCookieException Deprecated.Performs most commonCookie
validation- Specified by:
validate
in interfaceCookieSpec
- 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
- 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
-
domainMatch
Deprecated.Performs domain-match as implemented in common browsers.- Specified by:
domainMatch
in interfaceCookieSpec
- Parameters:
host
- The target host.domain
- The cookie domain attribute.- Returns:
- true if the specified host matches the given domain.
-
pathMatch
Deprecated.Performs path-match as implemented in common browsers.- Specified by:
pathMatch
in interfaceCookieSpec
- Parameters:
path
- The target path.topmostPath
- The cookie path attribute.- Returns:
- true if the paths match
-
match
Deprecated.Return an array ofCookie
s that should be submitted with a request with given attributes, false otherwise.- Specified by:
match
in interfaceCookieSpec
- Parameters:
host
- the host to which the request is being submittedport
- the port to which the request is being submitted (currently ignored)path
- the path to which the request is being submittedsecure
- true if the request is using a secure protocolcookies
- an array of Cookies to be matched- Returns:
- an array of Cookies matching the criterium
-
formatCookie
Deprecated.Return a string suitable for sending in a "Cookie" header- Specified by:
formatCookie
in interfaceCookieSpec
- Parameters:
cookie
- aCookie
to be formatted as string- Returns:
- a string suitable for sending in a "Cookie" header.
-
formatCookies
Deprecated.Create a "Cookie" header value containing allCookie
s in cookies suitable for sending in a "Cookie" header- Specified by:
formatCookies
in interfaceCookieSpec
- Parameters:
cookies
- an array ofCookie
s to be formatted- Returns:
- a string suitable for sending in a Cookie header.
- Throws:
IllegalArgumentException
- if an input parameter is illegal
-
formatCookieHeader
Deprecated.- Specified by:
formatCookieHeader
in interfaceCookieSpec
- Parameters:
cookies
- an array ofCookie
s to be formatted as a " Cookie" header- Returns:
- a "Cookie"
Header
.
-
formatCookieHeader
Deprecated.- Specified by:
formatCookieHeader
in interfaceCookieSpec
- Parameters:
cookie
- Cookies to be formatted as a Cookie header- Returns:
- a Cookie header.
-