Thursday, February 19, 2009

Using CGI Environment Variable in APEX

If you execute the following in SQL Workshop of APEX you will get a list of the variables that are available for use.

begin
OWA_UTIL.PRINT_CGI_ENV;
end;

This will return:

PLSQL_GATEWAY = WebDb

GATEWAY_IVERSION = 2

SERVER_SOFTWARE = Oracle Embedded PL/SQL Gateway/11.1.0.6.0

GATEWAY_INTERFACE = CGI/1.1

SERVER_PORT = 8080

SERVER_NAME = XDB HTTP Server

REQUEST_METHOD = POST

PATH_INFO = /wwv_flow.show

SCRIPT_NAME = /apex

REMOTE_HOST =

REMOTE_ADDR = 10.26.0.97

SERVER_PROTOCOL = HTTP/1.1

REQUEST_PROTOCOL = HTTP

REMOTE_USER = ANONYMOUS

ORACLE_SSO_USER =

HTTP_CONTENT_LENGTH = 285

HTTP_CONTENT_TYPE = application/x-www-form-urlencoded; charset=UTF-8

HTTP_USER_AGENT = Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6 (.NET CLR 3.5.30729)

HTTP_HOST = sparrow.hidinc.com:8080

HTTP_ACCEPT = text/html

HTTP_ACCEPT_ENCODING = gzip

HTTP_ACCEPT_LANGUAGE = en-us

HTTP_ACCEPT_CHARSET = ISO-8859-1

HTTP_REFERER = http://sparrow.hidinc.com:8080/apex/f?p=4500:1003:3536261107957055::NO:::

WEB_AUTHENT_PREFIX =

DAD_NAME = apex

DOC_ACCESS_PATH = docs

DOCUMENT_TABLE = wwv_flow_file_objects$

PATH_ALIAS =

REQUEST_CHARSET = AL32UTF8

REQUEST_IANA_CHARSET = UTF-8

SCRIPT_PREFIX =

HTTP_COOKIE = WWV_CUSTOM-F_4752219103344869_117=336B3BAFD41DE0F0; WWV_CUSTOM-F_4752219103344869_113=C7DAB25C26BF73CF; WWV_CUSTOM-F_988309881576256_1000=6F199DA1AEF14FB0; WWV_CUSTOM-F_4752219103344869_114=C544CAFF903CDE0F; oracle.uix=0^^GMT-6:00; activity_ask_expert=1|9500346262672; ORA_WWV_USER=336B3BAFD41DE0F0; ORA_WWV_REMEMBER_UN=BRIAN.BURDITT:BRIAN_TEST; ORA_WWV_ATTRIBUTE_PAGE=4301%2C%23HEAD; LOGIN_USERNAME_COOKIE=brian.burditt; ORA_WWV_R1=%23ALL; ORA_WWV_R2=%23ALL; ORA_WWV_R3=%23ALL


This can now be used with owa_util.get_cgi_env() for validations on these items.