DBA Data[Home] [Help]

PACKAGE: SYS.OWA_COOKIE

Source


1 package OWA_COOKIE is
2 
3    -- These procedures/functions are merely wrappers around
4    -- calls to send an HTTP_COOKIE and to get an HTTP_COOKIE.
5    -- One should be familiar with the specification for
6    -- HTTP cookies before attempting to use these subprograms.
7 
8    -- The HTTP specification for a COOKIE indicates that it
9    -- cookie name/value pairs should not exceed 4k in size.
10    type vc_arr is table of varchar2(4096) index by binary_integer;
11 
12    -- structure for cookies, as you could have multiple values
13    -- associated with a single cookie name.
14    type cookie is RECORD
15    (
16       name     varchar2(4096),
17       vals     vc_arr,
18       num_vals integer
19    );
20    -- Initializes the owa_cookie package variables (called by htp.init)
21    procedure init;
22 
23    -- Calls to the procedure SEND generate an HTTP header line
24    -- of the form:
25    -- Set-Cookie: <name>=<value> expires=<expires> path=<path>
26    --             domain=<domain> [secure] [HttpOnly]
27    -- Only the name and value are required (as per the HTTP_COOKIE spec),
28    -- and the default is non-secure.
29    -- Calls to SEND must fall in the context of an OWA procedure's
30    -- HTTP header output.  For example:
31 
32    -- begin
33    --    owa_util.mime_header('text/html', FALSE);
34    --                -- FALSE indicates not to close the header
35    --    owa_cookie.send('ITEM1','SOCKS');
36    --    owa_cookie.send('ITEM2','SHOES');
37    --    owa_util.http_header_close;
38    --
39    --    -- Now output the page the user will see.
40    --    htp.htmlOpen;
41    --    <etc>
42    procedure send(name     in varchar2,
43                   value    in varchar2,
44                   expires  in date     DEFAULT NULL,
45                   path     in varchar2 DEFAULT NULL,
46                   domain   in varchar2 DEFAULT NULL,
47                   secure   in varchar2 DEFAULT NULL,
48                   httponly in varchar2 DEFAULT NULL);
49 
50    -- GET will return an OWA_COOKIE.COOKIE structure
51    -- for the specified cookie name.
52    function get(name in varchar2) return cookie;
53 
54    -- REMOVE will simply force the expiration of an existing cookie.
55    -- This call must come within the context of an HTTP header.
56    -- See the definition of SEND above.
57    -- REMOVE generates a line which looks like:
58    -- Set-Cookie: <name>=<value> expires=01-JAN-1990
59    procedure remove(name in varchar2,
60                     val  in varchar2,
61                     path in varchar2 DEFAULT NULL);
62 
63    -- GET_ALL returns an array of name/value pairs of all HTTP_COOKIES
64    -- sent from the browser.  The name/value pairs appear in the order
65    -- that they were sent from the browser.
66    procedure get_all(names    out vc_arr,
67                      vals     out vc_arr,
68                      num_vals out integer);
69 end;