TPTP 4.4.0 Testing Tools Project
Public API Specification

org.eclipse.hyades.test.http.runner
Class HttpCookieCache

java.lang.Object
  extended byorg.eclipse.hyades.test.http.runner.HttpCookieCache

public class HttpCookieCache
extends java.lang.Object

This class handles cookies in the Cookie Cache. It stores them and then retrieves them for Http Request Headers.


Nested Class Summary
 class HttpCookieCache.InvalidCookieException
          this little inner class handles what few exceptions for invalid cookies might come up
 
Field Summary
 java.util.LinkedList CookieCache
           
 
Constructor Summary
HttpCookieCache()
           
 
Method Summary
 int add_new_cookie(int idx, int jdx, org.eclipse.hyades.test.http.runner.internal.exec.Cookie chip)
           
 int add_new_domain(org.eclipse.hyades.test.http.runner.internal.exec.Cookie chip, java.lang.String host)
          This routine adds a new domain to cookie cache linked lists.
 int add_new_path(int idx, org.eclipse.hyades.test.http.runner.internal.exec.Cookie chip)
          This routine adds a new path to CookieCache linked lists.
 int AddCookie(java.lang.String Name, java.lang.String Value, java.lang.String Domain, java.lang.String Path, java.lang.String Expires, boolean secure)
          This routine is for prepopulation ONLY.
 int check_dots(org.eclipse.hyades.test.http.runner.internal.exec.Cookie chip, java.lang.StringBuffer Message)
          this routine checks that the domain of a cookie has an appropriate number of dots.
 int check_ondom(HttpRequest req, org.eclipse.hyades.test.http.runner.internal.exec.Cookie chip, java.lang.StringBuffer Message)
          This routine checks that a host setting a cookie belongs to the domain of the cookie.
 void clearCookieCache()
          this routine is for clearing a populated Cache
 int cookie_match(org.eclipse.hyades.test.http.runner.internal.exec.CookieLL cookiep, java.lang.String ckienam)
          Deprecated. .. This routine is to be private in future
 void cookielogger(java.util.logging.Level lvl, java.lang.String mymsg)
          In order to have anything logged, JSR047 options must be turned on.
 void deleteCookie(java.lang.String Domain, java.lang.String Path, java.lang.String Name, java.lang.String Value)
           
 int domain_match(int getflag, java.lang.String dom1, java.lang.String dom2, org.eclipse.hyades.test.http.runner.internal.exec.DomLL domentry)
           
 void DynamicGetCookie(HttpRequest request)
          This is the routine to get a dynamic cookie from the Cache
 void DynamicSetCookie(HttpRequest request, HttpResponse response)
          This is the routine that sets dynamic cookies into the cache.
 int findattr(java.lang.String attr, java.lang.String str, int semi)
          This routine specifically searches for attribute strings of cookies
 int get_time_left(java.lang.String exp)
           
protected  int is_ipaddr(java.lang.String dom)
          this is a quick check to see if a domain is specified by ip addr it does not go so far as to check that the actual numbers used in the addr are valid for an ip address.
 void makecapcookie(java.lang.String reqhdrs, org.eclipse.hyades.test.http.runner.internal.exec.Cookie statc, java.util.LinkedList fndcookies, int eqi, HttpRequest request, java.lang.String cnam)
          this routine turns a captured cookie into a cookie object and lists it with fndcookies
 int parse_cookie(HttpRequest req, org.eclipse.hyades.test.http.runner.internal.exec.Cookie chip, java.lang.String setckhdr)
          This routine parses a cookie before setting it
 boolean parse_secure(int idx, java.lang.String tmpstr)
          This routine is checking that a 'secure' attribute is really an attribute
 int path_match(java.lang.String path1, java.lang.String path2)
          Deprecated. ... this is to be private in future
 void replace_cookie(int i, int j, int k, org.eclipse.hyades.test.http.runner.internal.exec.Cookie chip)
           
 int search_repl_cache(org.eclipse.hyades.test.http.runner.internal.exec.Cookie chip, java.lang.String host)
          This routine searches the cookie cache
 java.util.LinkedList sep_cookies(HttpHeader reqhdr)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CookieCache

public java.util.LinkedList CookieCache
Constructor Detail

HttpCookieCache

public HttpCookieCache()
Method Detail

DynamicSetCookie

public void DynamicSetCookie(HttpRequest request,
                             HttpResponse response)
                      throws HttpCookieCache.InvalidCookieException,
                             java.lang.Exception
This is the routine that sets dynamic cookies into the cache.

Parameters:
request - HttpRequest object containing HTTP request
response - HttpResponse object containing HTTP response
Throws:
HttpCookieCache.InvalidCookieException
java.lang.Exception

DynamicGetCookie

public void DynamicGetCookie(HttpRequest request)
This is the routine to get a dynamic cookie from the Cache

Parameters:
request - HttpRequest object containing request This routine searches the CookieCache and returns those matching the request for host/domain and path and security if they have not expired by the original Netscape cookie spec guidelines. The cookies are returned by adding a Cookie: hdr to the request object.

makecapcookie

public void makecapcookie(java.lang.String reqhdrs,
                          org.eclipse.hyades.test.http.runner.internal.exec.Cookie statc,
                          java.util.LinkedList fndcookies,
                          int eqi,
                          HttpRequest request,
                          java.lang.String cnam)
this routine turns a captured cookie into a cookie object and lists it with fndcookies


sep_cookies

public java.util.LinkedList sep_cookies(HttpHeader reqhdr)

AddCookie

public int AddCookie(java.lang.String Name,
                     java.lang.String Value,
                     java.lang.String Domain,
                     java.lang.String Path,
                     java.lang.String Expires,
                     boolean secure)
This routine is for prepopulation ONLY.

Parameters:
Name - String Name part of cookiename=value;
Value - String Value of cookiename.
Domain - String value of hostname or Domain name.
Path - String Value of Path
Expires - String value of expires= string
secure - Boolean for secure flag
Returns:
0 if all went well, -1 for error

deleteCookie

public void deleteCookie(java.lang.String Domain,
                         java.lang.String Path,
                         java.lang.String Name,
                         java.lang.String Value)

clearCookieCache

public void clearCookieCache()
this routine is for clearing a populated Cache


search_repl_cache

public int search_repl_cache(org.eclipse.hyades.test.http.runner.internal.exec.Cookie chip,
                             java.lang.String host)
This routine searches the cookie cache

Parameters:
chip - the cookie we are looking to place in cache
Returns:
successful

path_match

public int path_match(java.lang.String path1,
                      java.lang.String path2)
Deprecated. ... this is to be private in future

Parameters:
path1 - String
path2 - String
Returns:

replace_cookie

public void replace_cookie(int i,
                           int j,
                           int k,
                           org.eclipse.hyades.test.http.runner.internal.exec.Cookie chip)
Parameters:
i -
j -
k -
chip -

cookie_match

public int cookie_match(org.eclipse.hyades.test.http.runner.internal.exec.CookieLL cookiep,
                        java.lang.String ckienam)
Deprecated. .. This routine is to be private in future

Parameters:
cookiep -
ckienam -
Returns:

get_time_left

public int get_time_left(java.lang.String exp)
Parameters:
exp - Expires string from cookie
Returns:
0=not expired, 1=expired -1=error

domain_match

public int domain_match(int getflag,
                        java.lang.String dom1,
                        java.lang.String dom2,
                        org.eclipse.hyades.test.http.runner.internal.exec.DomLL domentry)
Parameters:
dom1 - first domain to compare
dom2 - second domain to compare
Returns:
0 for perfect match, 1 for tail match, -1 for no match

is_ipaddr

protected int is_ipaddr(java.lang.String dom)
this is a quick check to see if a domain is specified by ip addr it does not go so far as to check that the actual numbers used in the addr are valid for an ip address. That is assumed to be the responsibility of the server


add_new_domain

public int add_new_domain(org.eclipse.hyades.test.http.runner.internal.exec.Cookie chip,
                          java.lang.String host)
This routine adds a new domain to cookie cache linked lists.

Parameters:
chip -
host -
Returns:

add_new_path

public int add_new_path(int idx,
                        org.eclipse.hyades.test.http.runner.internal.exec.Cookie chip)
This routine adds a new path to CookieCache linked lists.

Parameters:
idx -
chip -
Returns:

add_new_cookie

public int add_new_cookie(int idx,
                          int jdx,
                          org.eclipse.hyades.test.http.runner.internal.exec.Cookie chip)
Parameters:
idx -
jdx -
chip -
Returns:

parse_cookie

public int parse_cookie(HttpRequest req,
                        org.eclipse.hyades.test.http.runner.internal.exec.Cookie chip,
                        java.lang.String setckhdr)
                 throws HttpCookieCache.InvalidCookieException
This routine parses a cookie before setting it

Throws:
HttpCookieCache.InvalidCookieException

findattr

public int findattr(java.lang.String attr,
                    java.lang.String str,
                    int semi)
This routine specifically searches for attribute strings of cookies


parse_secure

public boolean parse_secure(int idx,
                            java.lang.String tmpstr)
This routine is checking that a 'secure' attribute is really an attribute

Parameters:
idx -
tmpstr -
Returns:

check_ondom

public int check_ondom(HttpRequest req,
                       org.eclipse.hyades.test.http.runner.internal.exec.Cookie chip,
                       java.lang.StringBuffer Message)
This routine checks that a host setting a cookie belongs to the domain of the cookie.


check_dots

public int check_dots(org.eclipse.hyades.test.http.runner.internal.exec.Cookie chip,
                      java.lang.StringBuffer Message)
this routine checks that the domain of a cookie has an appropriate number of dots.


cookielogger

public void cookielogger(java.util.logging.Level lvl,
                         java.lang.String mymsg)
In order to have anything logged, JSR047 options must be turned on.

Parameters:
lvl - Integer..the logging level.
mymsg - String, the text of the message.

TPTP 4.4.0 Testing Tools Project
Public API Specification