Oracle Application Server HTTPClient API Reference
10g Release 2 (10.1.2)

B14020-02


HTTPClient
Class Cookie2

java.lang.Object
  extended byHTTPClient.Cookie
      extended byHTTPClient.Cookie2

All Implemented Interfaces:
java.io.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
See Also:
Serialized Form

Field Summary
protected  java.lang.String comment
           
protected  URI comment_url
           
protected  boolean discard
           
protected  boolean domain_set
           
protected  boolean path_set
           
protected  int[] port_list
           
protected  java.lang.String port_list_str
           
protected  boolean port_set
           
protected  int version
           

 

Fields inherited from class HTTPClient.Cookie
domain, expires, name, path, secure, value

 

Constructor Summary
protected Cookie2(RoRequest req)
          Use parse() to create cookies.
  Cookie2(java.lang.String name, java.lang.String value, java.lang.String domain, int[] port_list, java.lang.String path, java.util.Date expires, boolean discard, boolean secure, java.lang.String comment, URI comment_url)
          Create a cookie.

 

Method Summary
 boolean discard()
           
 java.lang.String getComment()
           
 URI getCommentURL()
           
 int[] getPorts()
           
 int getVersion()
           
protected static Cookie[] parse(java.lang.String set_cookie, RoRequest req)
          Parses the Set-Cookie2 header into an array of Cookies.
protected  boolean sendWith(RoRequest req)
           
protected  java.lang.String toExternalForm()
           
 java.lang.String toString()
          Create a string containing all the cookie fields.

 

Methods inherited from class HTTPClient.Cookie
equals, expires, getDomain, getName, getPath, getValue, hasExpired, hashCode, isSecure

 

Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait

 

Field Detail

version

protected int version

discard

protected boolean discard

comment

protected java.lang.String comment

comment_url

protected URI comment_url

port_list

protected int[] port_list

port_list_str

protected java.lang.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(java.lang.String name,
               java.lang.String value,
               java.lang.String domain,
               int[] port_list,
               java.lang.String path,
               java.util.Date expires,
               boolean discard,
               boolean secure,
               java.lang.String comment,
               URI comment_url)
Create a cookie.
Parameters:
name - the cookie name
value - the cookie value
domain - the host this cookie will be sent to
port_list - an array of allowed server ports for this cookie, or null if the the cookie may be sent to any port
path - the path prefix for which this cookie will be sent
expires - the Date this cookie expires, or null if never
discard - if true then the cookie will be discarded at the end of the session regardless of expiry
secure - if true this cookie will only be over secure connections
comment - the comment associated with this cookie, or null if none
comment_url - the comment URL associated with this cookie, or null if none
Throws:
java.lang.NullPointerException - if name, value, domain, or path is null

Cookie2

protected Cookie2(RoRequest req)
Use parse() to create cookies.
See Also:
parse(java.lang.String, HTTPClient.RoRequest)

Method Detail

parse

protected static Cookie[] parse(java.lang.String set_cookie,
                                RoRequest req)
                         throws java.net.ProtocolException
Parses the Set-Cookie2 header into an array of Cookies.
Parameters:
set_cookie - the Set-Cookie2 header received from the server
req - the request used
Returns:
an array of Cookies as parsed from the Set-Cookie2 header
Throws:
java.net.ProtocolException - if an error occurs during parsing

getVersion

public int getVersion()
Returns:
the version as an int

getComment

public java.lang.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()
Overrides:
discard in class Cookie
Returns:
true if the cookie should be discarded at the end of the session; false otherwise

sendWith

protected boolean sendWith(RoRequest req)
Overrides:
sendWith in class Cookie
Parameters:
req - the request to be sent
Returns:
true if this cookie should be sent with the request

toExternalForm

protected java.lang.String toExternalForm()
Overrides:
toExternalForm in class Cookie
Returns:
a string suitable for sending in a Cookie header.

toString

public java.lang.String toString()
Create a string containing all the cookie fields. The format is that used in the Set-Cookie header.
Overrides:
toString in class Cookie

Oracle Application Server HTTPClient API Reference
10g Release 2 (10.1.2)

B14020-02


Copyright © 2004, 2005, Oracle. All rights reserved.