Namespace: OpenEdge.Net.HTTP
Class 
CookieJar
Parent classes:
Progress.Lang.Object

Inherits: Progress.Lang.Object
Implements: OpenEdge.Net.HTTP.ICookieJar, OpenEdge.Core.ISupportInitialize

Copyright (c) 2014, 2015 by Progress Software Corporation. All rights reserved.
File:CookieJar
Purpose:Stores cookies temporarily and persistently
Author(s):pjudge
Created:Wed May 21 13:56:49 EDT 2014
Notes:* http://www.ietf.org/rfc/rfc6265.txt




Method Summary
Options Name Purpose
# AddCookie (character, character, Cookie) /** Adds a cookie to the jar, for a given domain/path. Do not save bad cookies: - that do not have matching domains - that are too broad in scope @param character The domain to which this cookie applies @param character The path to which this cookie applies @param Cookie The cookie to add */
# AddCookie (Cookie) /** Adds a single cookie to the jar (and persists, if needed). @param character A cookie string as received from the HTTP response. */
# AddCookies (Cookie[]) /** Adds a collection of cookies to the jar. @param Cookie The cookies to add */
+ INTEGER CheckCookie (URI, Cookie) /** Checks whether a cookie is valid for a URI @param URI The uri for which to retrieve cookies @param Cookie The cookie to check @return integer 1: cookie matches URI 0: cookie does not match URI -1: cookie matches URI and has expired */
# ClearPersistentCookies () /** Clears all persistent cookies */
# ClearSessionCookies () /** Clears all session cookies */
+ LOGICAL DeleteCookie (handle, Cookie) /** Removes a persistent cookie that corresponds to a session cookie. @param handle The buffer handle for the temp-table store @param Cookie The cookie to add into the store. @return logical True if the cookie was deleted from the store. */
# Destroy () /* Destroy/Shutdown/Anti-Initializer */
# INTEGER GetCookies (URI, Cookie[]) /** Returns a set of cookies for a given URI. Algorithm from finding relevant cookies derived from https://tools.ietf.org/html/rfc6265#page-25 (section 5.4) @param URI The host/URI for which to return the cookies. @param Cookie[] Output array of the cookies @return integer The number of cookies returned */
# Initialize () /* Initializer/Startup */
+ LoadCookieJar (character) /** Loads the cookie jar with persisted cookies, from disk. @param character The JOSN file in which the cookies are persisted. */
+ LogMessage (character, integer)
+ PersistCookieJar (character) /** Persists - to disk - the current set of persistent cookies */
+ PutCookie (handle, character, character, Cookie) /** Helper method for creating cookies in the relevant store (session or persistent). @param handle The buffer handle for the temp-table store @param character The domain to which this cookie applies @param character The path to which this cookie applies @param Cookie The cookie to add into the store. */
# LOGICAL RemoveCookie (Cookie) /** Removes a cookie from the jar. @param Cookie The cookie to remove @return logical True if the cookie was deleted. */

Constructor Summary
Options Name Purpose
CookieJar () /* static constructor */

Property Summary
Options Name Purpose
# CHARACTER CookieJarPath /** The location in which the cookies are persisted */


Method Detail
Top

PROTECTED AddCookie (character, character, Cookie)

Purpose: Adds a cookie to the jar, for a given domain/path.
Do not save bad cookies:
- that do not have matching domains
- that are too broad in scope
Parameters:
pcDomain CHARACTER
pcPath CHARACTER
poCookie OpenEdge.Net.HTTP.Cookie
Top

PROTECTED AddCookie (Cookie)

Purpose: Adds a single cookie to the jar (and persists, if needed).
Parameters:
poCookie OpenEdge.Net.HTTP.Cookie
Top

PROTECTED AddCookies (Cookie[])

Purpose: Adds a collection of cookies to the jar.
Parameters:
poCookies OpenEdge.Net.HTTP.Cookie
Top

PUBLIC INTEGER CheckCookie (URI, Cookie)

Purpose: Checks whether a cookie is valid for a URI
0: cookie does not match URI
-1: cookie matches URI and has expired
Parameters:
poURI OpenEdge.Net.URI
poCookie OpenEdge.Net.HTTP.Cookie
Returns INTEGER
integer 1: cookie matches URI
Top

PROTECTED ClearPersistentCookies ()

Purpose: Clears all persistent cookies
Top

PROTECTED ClearSessionCookies ()

Purpose: Clears all session cookies
Top

PUBLIC LOGICAL DeleteCookie (handle, Cookie)

Purpose: Removes a persistent cookie that corresponds to a session cookie.
Parameters:
phStore HANDLE
poCookie OpenEdge.Net.HTTP.Cookie
Returns LOGICAL
logical True if the cookie was deleted from the store.
Top

PROTECTED Destroy ()

/* Destroy/Shutdown/Anti-Initializer
Top

PROTECTED INTEGER GetCookies (URI, Cookie[])

Purpose: Returns a set of cookies for a given URI.
Algorithm from finding relevant cookies derived from
https://tools.ietf.org/html/rfc6265#page-25 //tools.ietf.org/html/rfc6265#page-25 (section 5.4)
Parameters:
poUri OpenEdge.Net.URI
poCookies OpenEdge.Net.HTTP.Cookie
Returns INTEGER
integer The number of cookies returned
Top

PROTECTED Initialize ()

/* Initializer/Startup
Top

PUBLIC LoadCookieJar (character)

Purpose: Loads the cookie jar with persisted cookies, from disk.
Parameters:
pcCookieJarPath CHARACTER
Top

PUBLIC LogMessage (character, integer)

Parameters:
pcMessage CHARACTER
piLogLevel INTEGER
Top

PUBLIC PersistCookieJar (character)

Purpose: Persists - to disk - the current set of persistent cookies
Parameters:
pcCookieJarPath CHARACTER
Top

PUBLIC PutCookie (handle, character, character, Cookie)

Purpose: Helper method for creating cookies in the relevant store (session or persistent).
Parameters:
phStore HANDLE
pcDomain CHARACTER
pcPath CHARACTER
poCookie OpenEdge.Net.HTTP.Cookie
Top

PROTECTED LOGICAL RemoveCookie (Cookie)

Purpose: Removes a cookie from the jar.
Parameters:
poCookie OpenEdge.Net.HTTP.Cookie
Returns LOGICAL
logical True if the cookie was deleted.


Constructor Detail
Top

STATIC CookieJar ()

/* static constructor


Property Detail
Top

PROTECTED CHARACTER CookieJarPath

Purpose: The location in which the cookies are persisted
Returns CHARACTER


10.27.2015 12:36:36