This sample can be accessed from:
portal-server-URL/rewriter/JavaScript/variables/url/js_urls.html
Ensure that abc.sesta.com is defined in the Proxies for Domains and Subdomains list in the Gateway service.
If this is not defined, a direct connection is assumed, and the Gateway URL is not prefixed.
Add the rule specified in this sample to the default_gateway_ruleset in the section "Rules for Rewriting JavaScript Source".
Edit the default_gateway_ruleset in the Rewriter service under Portal Server Configuration in the Portal Server administration console.
If you added the rule, restart the Gateway:
./psadmin start-sra-instance –u amadmin – f <password file> –N <profile name>– t <gateway> |
<html> Rewriting starts <head> <title>JavaScript Variable test page</title> </head> <body> <script LANGUAGE="Javascript"> <!-- //URL Variables var imgsrc="/tmp/tmp.jpg"; var imgsrc="./tmp/tmp.jpg"; var imgsrc="../tmp/tmp.jpg"; var imgsrc="../../tmp/tmp.jpg"; var imgsrc="http://abc.sesta.com/tmp/tmp.jpg"; var imgsrc="../../../tmp/tmp.jpg"; var imgsrc="tmp/tmp.jpg"; //--> </SCRIPT> <br> Testing JavaScript variables! <br> <img src="images/logo.gif"> <br> Image </body> <br> Rewriting ends </html>
<Variable name=”imgsrc” type="URL"/>
<html> Rewriting starts <head> <title>JavaScript Variable test page</title> </head> <body> <script LANGUAGE="Javascript"> <!-- //URL Variables var imgsrc="gateway-URL/portal-server-URL/tmp/tmp.jpg"; var imgsrc="gateway-URL/portal-server-URL /rewriter/JavaScript/variables/url/tmp/tmp.jpg"; var imgsrc="gateway-URL/portal-server-URL /rewriter/JavaScript/variables/tmp/tmp.jpg"; var imgsrc="gateway-URL/portal-server-URL /rewriter/JavaScript/tmp/tmp.jpg"; var imgsrc="gateway-URL/http://abc.sesta.com/tmp/tmp.jpg"; var imgsrc="gateway-URL/portal-server-URL/rewriter/tmp/tmp.jpg"; var imgsrc="gateway-URL/portal-server-URL /rewriter/JavaScript/variables/url/tmp/tmp.jpg";
// All the above URLs are JavaScript variables of type URL and name imgsrc as specified in the rule. Hence they are prefixed with the Gateway and the Portal Server URLs. The path following the Portal Server URL is prefixed as required.
//--> </SCRIPT> <br> Testing JavaScript variables! <br> <img src="gateway URL/portal-server-URL/rewriter /JavaScript/variables/url/images/logo.gif">
// This line is rewritten because the rule <Attribute name="src"/> is defined in the default_gateway_ruleset
<br> Image </body> <br> Rewriting ends </html>