Class Cookie2
java.lang.Object
org.apache.commons.httpclient.NameValuePair
org.apache.commons.httpclient.Cookie
org.apache.commons.httpclient.cookie.Cookie2
- All Implemented Interfaces:
Serializable
,Comparator
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 class for RFC2965Spec
cookie specification. It extends Cookie
class and adds newer cookie
attributes and functions required for this specification.
- Since:
- 3.1
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Deprecated.static final String
Deprecated.static final String
Deprecated.static final String
Deprecated.static final String
Deprecated.static final String
Deprecated.static final String
Deprecated.static final String
Deprecated.static final String
Deprecated. -
Constructor Summary
ConstructorsConstructorDescriptionCookie2()
Deprecated.Default constructor.Deprecated.Creates a cookie with the given name, value and domain attribute.Deprecated.Creates a cookie with the given name, value, domain attribute, path attribute, expiration attribute, and secure attributeCookie2
(String domain, String name, String value, String path, Date expires, boolean secure, int[] ports) Deprecated.Creates a cookie with the given name, value, domain attribute, path attribute, expiration attribute, secure attribute, and ports attribute. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.If a user agent (web browser) presents this cookie to a user, the cookie's purpose will be described by the information at this URL.int[]
getPorts()
Deprecated.Get the Port attribute.boolean
Deprecated.Returns false if the cookie should be discarded at the end of the "session"; true otherwise.boolean
Deprecated.boolean
Deprecated.boolean
Deprecated.void
setCommentURL
(String commentURL) Deprecated.If a user agent (web browser) presents this cookie to a user, the cookie's purpose will be described by the information at this URL.void
setDiscard
(boolean toDiscard) Deprecated.Set the Discard attribute.void
setPortAttributeBlank
(boolean value) Deprecated.Indicates whether the Port attribute in Set-Cookie2 header contains no value (is of the form Port="").void
setPortAttributeSpecified
(boolean value) Deprecated.Indicates whether the cookie had a port attribute specified in the Set-Cookie2 response header.void
setPorts
(int[] ports) Deprecated.Set the Port attribute.void
setVersionAttributeSpecified
(boolean value) Deprecated.Indicates whether the cookie had a version attribute specified in the Set-Cookie2 response header.Deprecated.Return a textual representation of the cookie.Methods inherited from class org.apache.commons.httpclient.Cookie
compare, equals, getComment, getDomain, getExpiryDate, getPath, getSecure, getVersion, hashCode, isDomainAttributeSpecified, isExpired, isExpired, isPathAttributeSpecified, setComment, setDomain, setDomainAttributeSpecified, setExpiryDate, setPath, setPathAttributeSpecified, setSecure, setVersion, toString
Methods inherited from class org.apache.commons.httpclient.NameValuePair
getName, getValue, setName, setValue
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
DOMAIN
Deprecated.- See Also:
-
PATH
Deprecated.- See Also:
-
PORT
Deprecated.- See Also:
-
VERSION
Deprecated.- See Also:
-
SECURE
Deprecated.- See Also:
-
MAXAGE
Deprecated.- See Also:
-
COMMENT
Deprecated.- See Also:
-
COMMENTURL
Deprecated.- See Also:
-
DISCARD
Deprecated.- See Also:
-
-
Constructor Details
-
Cookie2
public Cookie2()Deprecated.Default constructor. Creates a blank cookie -
Cookie2
Deprecated.Creates a cookie with the given name, value and domain attribute.- Parameters:
domain
- the domain this cookie can be sent toname
- the cookie namevalue
- the cookie value
-
Cookie2
Deprecated.Creates a cookie with the given name, value, domain attribute, path attribute, expiration attribute, and secure attribute- Parameters:
domain
- the domain this cookie can be sent toname
- the cookie namevalue
- the cookie valuepath
- the path prefix for which this cookie can be sentexpires
- theDate
at which this cookie expires, or null if the cookie expires at the end of the sessionsecure
- if true this cookie can only be sent over secure connections- Throws:
IllegalArgumentException
- If cookie name is null or blank, cookie name contains a blank, or cookie name starts with character $
-
Cookie2
public Cookie2(String domain, String name, String value, String path, Date expires, boolean secure, int[] ports) Deprecated.Creates a cookie with the given name, value, domain attribute, path attribute, expiration attribute, secure attribute, and ports attribute.- Parameters:
domain
- the domain this cookie can be sent toname
- the cookie namevalue
- the cookie valuepath
- the path prefix for which this cookie can be sentexpires
- theDate
at which this cookie expires, or null if the cookie expires at the end of the sessionsecure
- if true this cookie can only be sent over secure connectionsports
- the ports for which this cookie can be sent- Throws:
IllegalArgumentException
- If cookie name is null or blank, cookie name contains a blank, or cookie name starts with character $
-
-
Method Details
-
getCommentURL
Deprecated.If a user agent (web browser) presents this cookie to a user, the cookie's purpose will be described by the information at this URL.- See Also:
-
setCommentURL
Deprecated.If a user agent (web browser) presents this cookie to a user, the cookie's purpose will be described by the information at this URL.- Parameters:
commentURL
-- See Also:
-
getPorts
public int[] getPorts()Deprecated.Get the Port attribute. It restricts the ports to which a cookie may be returned in a Cookie request header.- See Also:
-
setPorts
public void setPorts(int[] ports) Deprecated.Set the Port attribute. It restricts the ports to which a cookie may be returned in a Cookie request header.- Parameters:
ports
-- See Also:
-
setDiscard
public void setDiscard(boolean toDiscard) Deprecated.Set the Discard attribute. Note: Discard attribute overrides Max-age.- See Also:
-
isPersistent
public boolean isPersistent()Deprecated.Returns false if the cookie should be discarded at the end of the "session"; true otherwise.- Overrides:
isPersistent
in classCookie
- Returns:
- false if the cookie should be discarded at the end of the "session"; true otherwise
-
setPortAttributeSpecified
public void setPortAttributeSpecified(boolean value) Deprecated.Indicates whether the cookie had a port attribute specified in the Set-Cookie2 response header.- Parameters:
value
- true if port attribute is specified in response header.- See Also:
-
isPortAttributeSpecified
public boolean isPortAttributeSpecified()Deprecated.- Returns:
- true if cookie port attribute was specified in the Set-Cookie2 header.
- See Also:
-
setPortAttributeBlank
public void setPortAttributeBlank(boolean value) Deprecated.Indicates whether the Port attribute in Set-Cookie2 header contains no value (is of the form Port="").This value is required for generating the Cookie request header because the specification requires that if Set-Cookie2 header contains a blank value for port attribute, the Cookie header should also contain a port attribute with no value.
- Parameters:
value
- true if port attribute is specified as blank in response header.- See Also:
-
isPortAttributeBlank
public boolean isPortAttributeBlank()Deprecated.- Returns:
- true if the port attribute in Set-Cookie2 header had no value (was of the form Port="").
- See Also:
-
setVersionAttributeSpecified
public void setVersionAttributeSpecified(boolean value) Deprecated.Indicates whether the cookie had a version attribute specified in the Set-Cookie2 response header.- Parameters:
value
- true if version attribute is specified in response header.- See Also:
-
isVersionAttributeSpecified
public boolean isVersionAttributeSpecified()Deprecated.- Returns:
- true if cookie version attribute was specified in the Set-Cookie2 header.
- See Also:
-
toExternalForm
Deprecated.Return a textual representation of the cookie.- Overrides:
toExternalForm
in classCookie
- Returns:
- string.
-