Sun Java System Portal Server Secure Remote Access 7.2 管理指南

JavaScript SYSTEM 变量示例

Procedure使用 JavaScript 系统变量示例

  1. 可从以下位置访问本示例:

    portal-server-URL /rewriter/JavaScript/variables/system/system.html

  2. 将本示例中指定的规则(如果尚不存在)添加到“JavaScript 源重写规则”一节的 default_gateway_ruleset 中。

  3. 在 Portal Server 管理控制台中,编辑 Portal Server 配置下的重写器服务中的 default_gateway_ruleset

  4. 重新启动网关:


    ./psadmin start-sra-instance –u amadmin – f  <password file> –N <profile name>– t  <gateway>
    

重写前的 HTML 页

<html>
<head>
<title>JavaScript SYSTEM Variables Test Page</title>
</head>
<body>
<script LANGUAGE="Javascript">
<!--
//SYSTEM Var
alert(window.location.pathname);
//document.write
("<A HREF="+window.location.pathname+">SYSTEM</A><P>")
//-->
</SCRIPT>
Testing JavaScript SYSTEM Variables
<br>
This page displays the path where 
the current page is located when loaded.
</body>
</html>

规则

<Variable name="window.location.pathname" type="SYSTEM"/>

重写后的 HTML

<html>
<head>
<title>JavaScript SYSTEM Variables Test Page</title>
</head>
<body>
<SCRIPT>
convertsystem function definition...
</SCRIPT>
<script LANGUAGE="Javascript">
<!--
//SYSTEM Var
alert(psSRAPRewriter_convert_system
(window.location, window.location.pathname, "window.location"));

// 重写器将 window.location.pathname 确定为 JavaScript SYSTEM 变量。无法在服务器端确定该变量的值。因此,重写器会在此变量前加上 psSRAPRewriter_convert_pathname 函数。这个包裹函数将在客户机端确定变量的值,并根据需要进行重写。

//-->
</SCRIPT>
Testing JavaScript SYSTEM Variables
<br>
This page displays the path where
the current page is located when loaded.
</body>
</html>