Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
REM Add to ORDS config
REM <entry key="procedure.rest.preHook">klrice.my_ords_ctx.populate</entry>
REM Create a context
CREATE OR REPLACE CONTEXT ords_params USING my_ords_ctx;
REM PKG to populate the context
CREATE OR REPLACE PACKAGE my_ords_ctx AS
function populate return boolean;
END my_ords_ctx;
/
SHOW ERRORS
create or replace PACKAGE BODY my_ords_ctx IS
procedure setparam(p_name in varchar2) as
begin
-- place into context
DBMS_SESSION.set_context('ords_params', p_name, OWA_UTIL.get_cgi_env(p_name));
end setparam;
function populate return boolean as
BEGIN
-- add everything
setparam('user-agent');
setparam('host');
setparam('accept');
setparam('APEX_LISTENER_VERSION');
setparam('DAD_NAME');
setparam('DOC_ACCESS_PATH');
setparam('DOCUMENT_TABLE');
setparam('GATEWAY_IVERSION');
setparam('GATEWAY_INTERFACE');
setparam('HTTP_ACCEPT');
setparam('HTTP_ACCEPT_ENCODING');
setparam('HTTP_ACCEPT_LANGUAGE');
setparam('HTTP_ACCEPT_CHARSET');
setparam('HTTP_IF_MODIFIED_SINCE');
setparam('HTTP_IF_NONE_MATCH');
setparam('HTTP_HOST');
setparam('HTTP_ORACLE_ECID');
setparam('HTTP_PORT');
setparam('HTTP_REFERER');
setparam('HTTP_USER_AGENT');
setparam('PATH_ALIAS');
setparam('PATH_INFO');
setparam('PLSQL_GATEWAY');
setparam('QUERY_STRING');
setparam('REMOTE_ADDR');
setparam('REMOTE_USER');
setparam('REQUEST_CHARSET');
setparam('REQUEST_IANA_CHARSET');
setparam('REQUEST_METHOD');
setparam('REQUEST_PROTOCOL');
setparam('REQUEST_SCHEME');
setparam('SCRIPT_NAME');
setparam('SCRIPT_PREFIX');
setparam('SERVER_NAME');
setparam('SERVER_PORT');
setparam('SERVER_PROTOCOL');
setparam('SERVER_SOFTWARE');
setparam('WEB_AUTHENT_PREFIX');
setparam('HTTP_COOKIE');
return true;
END populate;
END my_ords_ctx;
/
SHOW ERRORS
grant execute on my_ords_ctx to public
/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.