user1110790
user1110790

Reputation: 787

Is it possible to return HTTP response code to the browser using pl/sql?

I am working on web application written in pl/sql . It uses Basic Authentication. Now there is no efficient way of logging out unless you close the browser. This is what I am using on the log off page

owa_util.mime_header('text/html', FALSE, NULL);
v_browser:= owa_util.get_cgi_env('HTTP_USER_AGENT');
owa_cookie.send('WDB_GATEWAY_LOGOUT', 'YES', path=>'/');
-- Close the HTTP header
owa_util.status_line(401,'Unauthorzed Access', true);
owa_util.http_header_close;

Is this even possible. I'll appreciate your help. Thank you

Upvotes: 1

Views: 1649

Answers (1)

rkosegi
rkosegi

Reputation: 14678

Yes, oracle has package called utl_http and utl_url

From docs:

HTTP_UNAUTHORIZED CONSTANT PLS_INTEGER := 401

RESP Type

This PL/SQL record type is used to represent an HTTP response.

Syntax

TYPE resp IS RECORD (
   status_code    PLS_INTEGER,
   reason_phrase  VARCHAR2(256),
   http_version   VARCHAR2(64),
);

Upvotes: 1

Related Questions