我正在尝试将Oracle PL / SQL环境(Oracle 10g数据库)中的AJAX请求与标准HTTP请求区分开来。我已将 X-Requested-With 添加到我的 PlsqlCGIEnvironmentList ,当我使用owa_util.print_cgi_env;
打印CGI变量时,确实会看到一个值。
以下是一个例子:
PLSQL_GATEWAY = WebDb
GATEWAY_IVERSION = 3
SERVER_SOFTWARE = Oracle-Application-Server-10g/10.1.2.0.2 Oracle-HTTP-Server
GATEWAY_INTERFACE = CGI/1.1
SERVER_PORT = 7779
SERVER_NAME = myserver.com
REQUEST_METHOD = GET
QUERY_STRING = action=change_contact&doc_id=10032
PATH_INFO = /!fc
SCRIPT_NAME = /script
REMOTE_ADDR = 172.30.170.125
SERVER_PROTOCOL = HTTP/1.1
REQUEST_PROTOCOL = HTTP
REMOTE_USER = myuser
HTTP_USER_AGENT = Mozilla/5.0 (Windows NT 6.1; rv:26.0) Gecko/20100101 Firefox/26.0
HTTP_HOST = myserver.com
HTTP_ACCEPT = text/html, */*; q=0.01
HTTP_ACCEPT_LANGUAGE = en-US,en;q=0.5
HTTP_REFERER = http://myserver.com/script/!fc?action=doc&doc_id=10032
HTTP_ORACLE_ECID = 175007308883,1
HTTP_ORACLE_CACHE_VERSION = 10.1.2
WEB_AUTHENT_PREFIX =
DAD_NAME = script
DOC_ACCESS_PATH = docs
DOCUMENT_TABLE = wpg_document
PATH_ALIAS =
REQUEST_CHARSET = WE8MSWIN1252
REQUEST_IANA_CHARSET = WINDOWS-1252
SCRIPT_PREFIX =
X-Requested-With = XMLHttpRequest
HTTP_COOKIE = SMIDENTITY=0emF6I4...
问题是,即使对于上面显示owa_util.get_cgi_env('X-Requested-With')
X-Requested-With = XMLHttpRequest
也始终为空
知道我的问题可能是什么吗?
答案 0 :(得分:0)
我无法访问10g,但我查看了11gR2中的OWA_UTIL代码。 感兴趣的项目是在get_cgi_env中应用的UPPER函数。 有可能在10g中,它在比较的一端而不是另一端进行UPPER,因此包括小写的任何变量都不匹配。
procedure print_cgi_env is
begin
for i in 1..owa.num_cgi_vars
loop
htp.print(owa.cgi_var_name(i)||' = '||owa.cgi_var_val(i)||htf.nl);
end loop;
end;
function get_cgi_env(param_name in varchar2) return varchar2 is
upper_param_name varchar2(2000) := upper(param_name);
begin
for i in 1..owa.num_cgi_vars
loop
if (upper(owa.cgi_var_name(i)) = upper_param_name)
then return(owa.cgi_var_val(i));
end if;
end loop;
return NULL;
end;
检查您的OWA_UTIL。