The OWA_COOKIE package provides an interface for sending and retrieving HTTP cookies from the client's browser.
See Also:
For more information about implementation of this package:The chapter contains the following topics:
Overview
Types
Rules and Limits
Cookies are opaque strings sent to the browser to maintain state between HTTP calls. State can be maintained throughout the client's sessions, or longer if an expiration date is included. The system date is calculated with reference to the information specified in the OWA_CUSTOM package.
This data type contains cookie name-value pairs. Since the HTTP standard allows cookie names to be overloaded (that is, multiple values can be associated with the same cookie name), there is a PL/SQL RECORD
holding all values associated with a given cookie name.
TYPE vc_arr IS TABLE OF VARCHAR2(4000) INDEX BY BINARY_INTEGER. TYPE COOKIE IS RECORD ( name VARCHAR2(4000), vals vc_arr, num_vals INTEGER);
All HTTP headers must be in English and the ASCII character set. If the headers are generated from the database, verify they are created in the English language.
Table 142-1 OWA_COOKIE Package Subprograms
Subprogram | Description |
---|---|
Gets the value of the specified cookie |
|
Gets all cookie name-value pairs |
|
Removes the specified cookie |
|
Generates a "Set-Cookie" line in the HTTP header |
This function returns the values associated with the specified cookie. The values are returned in a OWA_COOKIE.COOKIE
DATA
TYPE
.
OWA_COOKIE.GET( name IN VARCHAR2) RETURN COOKIE;
OWA_COOKIE.COOKIE
DATA
TYPE
.
This procedure returns all cookie names and their values from the client's browser. The values appear in the order in which they were sent from the browser.
OWA_COOKIE.GET_ALL( names OUT vc_arr, vals OUT vc_arr, num_vals OUT INTEGER);
Table 142-3 GET_ALL Procedure Parameters
Parameter | Description |
---|---|
|
The names of the cookies. |
|
The values of the cookies. |
|
The number of cookie-value pairs. |
This procedure forces a cookie to expire immediately by setting the "expires" field of a Set-Cookie line in the HTTP header to "01-Jan-1990". This procedure must be called within the context of an HTTP header.
OWA_COOKIE.REMOVE( name IN VARCHAR2, val IN VARCHAR2, path IN VARCHAR2 DEFAULT NULL);
Table 142-4 REMOVE Procedure Parameters
Parameter | Description |
---|---|
|
The name of the cookie to expire. |
|
The value of the cookie. |
|
[Currently unused] |
This procedure generates a Set-Cookie line, which transmits a cookie to the client. This procedure must occur in the context of an HTTP header.
OWA_COOKIE.SEND( name in varchar2, value in varchar2, expires in date DEFAULT NULL, path in varchar2 DEFAULT NULL, domain in varchar2 DEFAULT NULL, secure in varchar2 DEFAULT NULL);
Table 142-5 SEND Procedure Parameters
Parameter | Description |
---|---|
|
The name of the cookie. |
|
The value of the cookie. |
|
The date at which the cookie will expire |
|
The value for the path field. |
|
The value for the domain field. |
|
If the value of this parameter is not |