Package org.apache.http.impl.cookie
Class BasicClientCookie2
java.lang.Object
org.apache.http.impl.cookie.BasicClientCookie
org.apache.http.impl.cookie.BasicClientCookie2
- All Implemented Interfaces:
Cloneable,ClientCookie,Cookie,SetCookie,SetCookie2
public class BasicClientCookie2 extends BasicClientCookie implements SetCookie2
HTTP "magic-cookie" represents a piece of state information
that the HTTP agent and the target server can exchange to maintain
a session as specified by RFC2965.
- Author:
- Oleg Kalnichevski
-
Field Summary
Fields inherited from interface org.apache.http.cookie.ClientCookie
COMMENT_ATTR, COMMENTURL_ATTR, DISCARD_ATTR, DOMAIN_ATTR, EXPIRES_ATTR, MAX_AGE_ATTR, PATH_ATTR, PORT_ATTR, SECURE_ATTR, VERSION_ATTR -
Constructor Summary
Constructors Constructor Description BasicClientCookie2(String name, String value)Default Constructor taking a name and a value. -
Method Summary
Modifier and Type Method Description Objectclone()Creates and returns a copy of thisObject.StringgetCommentURL()Returns null.int[]getPorts()Returns null.booleanisExpired(Date date)Returns true if this cookie has expired.booleanisPersistent()Returns false if the cookie should be discarded at the end of the "session"; true otherwise.voidsetCommentURL(String commentURL)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.voidsetDiscard(boolean discard)Set the Discard attribute.voidsetPorts(int[] ports)Sets the Port attribute.Methods inherited from class org.apache.http.impl.cookie.BasicClientCookie
containsAttribute, getAttribute, getComment, getDomain, getExpiryDate, getName, getPath, getValue, getVersion, isSecure, setAttribute, setComment, setDomain, setExpiryDate, setPath, setSecure, setValue, setVersion, toStringMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.http.cookie.Cookie
getComment, getDomain, getExpiryDate, getName, getPath, getValue, getVersion, isSecureMethods inherited from interface org.apache.http.cookie.SetCookie
setComment, setDomain, setExpiryDate, setPath, setSecure, setValue, setVersion
-
Constructor Details
-
BasicClientCookie2
Default Constructor taking a name and a value. The value may be null.- Parameters:
name- The name.value- The value.
-
-
Method Details
-
getPorts
public int[] getPorts()Description copied from class:BasicClientCookieReturns null. Cookies prior to RFC2965 do not set this attribute- Specified by:
getPortsin interfaceCookie- Overrides:
getPortsin classBasicClientCookie
-
setPorts
public void setPorts(int[] ports)Description copied from interface:SetCookie2Sets the Port attribute. It restricts the ports to which a cookie may be returned in a Cookie request header.- Specified by:
setPortsin interfaceSetCookie2
-
getCommentURL
Description copied from class:BasicClientCookieReturns null. Cookies prior to RFC2965 do not set this attribute- Specified by:
getCommentURLin interfaceCookie- Overrides:
getCommentURLin classBasicClientCookie
-
setCommentURL
Description copied from interface:SetCookie2If a user agent (web browser) presents this cookie to a user, the cookie's purpose will be described by the information at this URL.- Specified by:
setCommentURLin interfaceSetCookie2
-
setDiscard
public void setDiscard(boolean discard)Description copied from interface:SetCookie2Set the Discard attribute. Note: Discard attribute overrides Max-age.- Specified by:
setDiscardin interfaceSetCookie2- See Also:
Cookie.isPersistent()
-
isPersistent
public boolean isPersistent()Description copied from class:BasicClientCookieReturns false if the cookie should be discarded at the end of the "session"; true otherwise.- Specified by:
isPersistentin interfaceCookie- Overrides:
isPersistentin classBasicClientCookie- Returns:
- false if the cookie should be discarded at the end of the "session"; true otherwise
-
isExpired
Description copied from class:BasicClientCookieReturns true if this cookie has expired.- Specified by:
isExpiredin interfaceCookie- Overrides:
isExpiredin classBasicClientCookie- Parameters:
date- Current time- Returns:
- true if the cookie has expired.
-
clone
Description copied from class:ObjectCreates and returns a copy of thisObject. The default implementation returns a so-called "shallow" copy: It creates a new instance of the same class and then copies the field values (including object references) from this instance to the new instance. A "deep" copy, in contrast, would also recursively clone nested objects. A subclass that needs to implement this kind of cloning should callsuper.clone()to create the new instance and then create deep copies of the nested, mutable objects.- Overrides:
clonein classBasicClientCookie- Returns:
- a copy of this object.
- Throws:
CloneNotSupportedException- if this object's class does not implement theCloneableinterface.
-