EAF 7.4 Implementation

com.lutris.http
Class HttpCookieManager

java.lang.Object
  extended by com.lutris.http.HttpCookieManager

public class HttpCookieManager
extends java.lang.Object

This object manages cookies defined in http request and response headers.

Since:
Harmony2.0
Version:
$Revision: 1.3 $
Author:
Kyle Clark

Constructor Summary
HttpCookieManager()
          Constructs a new cookie manager.
 
Method Summary
 void clear()
          Removes all cookies from this manager.
 javax.servlet.http.Cookie[] getCookies()
          Returns an array of the cookies being managed.
 java.lang.String getRequestHeader()
          Returns the string representation of all the cookies being managed by this object as an http cookie request header.
 java.lang.String getRequestHeader(java.lang.String path, java.lang.String domain)
          Returns the string representation of the cookies being managed by this object as an http cookie request header The format of the header is:
 java.lang.String getResponseHeader()
          Returns the string representation of the cookies being managed by this object as an http cookie response ("Set-Cookie") header.
 void mergeHeader(java.lang.String header)
          Merges the cookies contained in the specified http response header into the set of cookies being managed by this object.
 java.lang.String toString()
          Returns the string representation of the headers/cookies being managed by this object as an http cookie response header (i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HttpCookieManager

public HttpCookieManager()
Constructs a new cookie manager.

Method Detail

getRequestHeader

public java.lang.String getRequestHeader()
Returns the string representation of all the cookies being managed by this object as an http cookie request header. The format of the header is:
    NAME1=VALUE1; NAME2=VALUE2; ....
 

Returns:
the "Cookie" header as it would appear in an http request header.

getRequestHeader

public java.lang.String getRequestHeader(java.lang.String path,
                                         java.lang.String domain)
Returns the string representation of the cookies being managed by this object as an http cookie request header The format of the header is:
    NAME1=VALUE1; NAME2=VALUE2; ....
 

Parameters:
path - Only return the cookies that are valid in the specified path. If path is null then path is ignored.
domain - Only return the cookies that are valid in the specified domain. If null, the domain is ignored.
Returns:
the "Cookie" header as it would appear in an http request or null if this object contains no cookies that apply to the path and domain contraints.

getResponseHeader

public java.lang.String getResponseHeader()
Returns the string representation of the cookies being managed by this object as an http cookie response ("Set-Cookie") header. The format of the header is a comma (,) separated list of:
   name=value [;EXPIRES=dateValue] [;DOMAIN=domainName]
              [;PATH=path] [;SECURE]
 

Returns:
the string representation of the cookies being managed by this object as an http cookie response header ("Set-Cookie"). null is returned if there aren't any cookies being managed by this cookie manager.

mergeHeader

public void mergeHeader(java.lang.String header)
Merges the cookies contained in the specified http response header into the set of cookies being managed by this object.

Parameters:
header - the Set-Cookie http response header to merge.

getCookies

public javax.servlet.http.Cookie[] getCookies()
Returns an array of the cookies being managed.

Returns:
enumeration of javax.servlet.http.Cookie objects.
See Also:
Cookie

clear

public void clear()
Removes all cookies from this manager.


toString

public java.lang.String toString()
Returns the string representation of the headers/cookies being managed by this object as an http cookie response header (i.e. Set-Cookie header).

Overrides:
toString in class java.lang.Object
Returns:
the string representation of the cookies being managed by this object as an http cookie response header (i.e. Set-Cookie header).

EAF 7.4 Implementation