Class Cookie2
- java.lang.Object
-
- org.exoplatform.common.http.client.Cookie
-
- org.exoplatform.common.http.client.Cookie2
-
- All Implemented Interfaces:
Serializable
public class Cookie2 extends Cookie
This class represents an http cookie as specified in the HTTP State Management Mechanism spec (also known as a version 1 cookie).- Since:
- V0.3
- Version:
- 0.3-3 06/05/2001
- Author:
- Ronald Tschal�r
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Stringcommentprotected URIcomment_urlprotected booleandiscardprotected booleandomain_setprotected booleanpath_setprotected int[]port_listprotected Stringport_list_strprotected booleanport_setprotected intversion
-
Constructor Summary
Constructors Modifier Constructor Description Cookie2(String name, String value, String domain, int[] port_list, String path, Date expires, boolean discard, boolean secure, String comment, URI comment_url)Create a cookie.protectedCookie2(RoRequest req)Useparse()to create cookies.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandiscard()StringgetComment()URIgetCommentURL()int[]getPorts()intgetVersion()protected static Cookie[]parse(String set_cookie, RoRequest req)Parses the Set-Cookie2 header into an array of Cookies.protected booleansendWith(RoRequest req)protected StringtoExternalForm()StringtoString()Create a string containing all the cookie fields.
-
-
-
Field Detail
-
version
protected int version
-
discard
protected boolean discard
-
comment
protected String comment
-
comment_url
protected URI comment_url
-
port_list
protected int[] port_list
-
port_list_str
protected String port_list_str
-
path_set
protected boolean path_set
-
port_set
protected boolean port_set
-
domain_set
protected boolean domain_set
-
-
Constructor Detail
-
Cookie2
public Cookie2(String name, String value, String domain, int[] port_list, String path, Date expires, boolean discard, boolean secure, String comment, URI comment_url)
Create a cookie.- Parameters:
name- the cookie namevalue- the cookie valuedomain- the host this cookie will be sent toport_list- an array of allowed server ports for this cookie, or null if the the cookie may be sent to any portpath- the path prefix for which this cookie will be sentexpires- the Date this cookie expires, or null if neverdiscard- if true then the cookie will be discarded at the end of the session regardless of expirysecure- if true this cookie will only be over secure connectionscomment- the comment associated with this cookie, or null if nonecomment_url- the comment URL associated with this cookie, or null if none- Throws:
NullPointerException- if name, value, domain, or path is null
-
Cookie2
protected Cookie2(RoRequest req)
Useparse()to create cookies.- See Also:
parse(String, RoRequest)
-
-
Method Detail
-
parse
protected static Cookie[] parse(String set_cookie, RoRequest req) throws ProtocolException
Parses the Set-Cookie2 header into an array of Cookies.- Parameters:
set_cookie- the Set-Cookie2 header received from the serverreq- the request used- Returns:
- an array of Cookies as parsed from the Set-Cookie2 header
- Throws:
ProtocolException- if an error occurs during parsing
-
getVersion
public int getVersion()
- Returns:
- the version as an int
-
getComment
public String getComment()
- Returns:
- the comment string, or null if none was set
-
getCommentURL
public URI getCommentURL()
- Returns:
- the comment url
-
getPorts
public int[] getPorts()
- Returns:
- the array of ports
-
discard
public boolean discard()
-
sendWith
protected boolean sendWith(RoRequest req)
-
toExternalForm
protected String toExternalForm()
- Overrides:
toExternalFormin classCookie- Returns:
- a string suitable for sending in a Cookie header.
-
-