This sample can be accessed from:
<portal-install-location>/SUNWportal/samples/rewriter
Add the rule specified in this sample (if it does not already exist) to the default_gateway_ruleset in the section Rules for Rewriting JavaScript Source.
Edit the default_gateway_ruleset in the Rewriter service using the Portal Server administration console.
Restart the Gateway:
./psadmin start-sra-instance –u amadmin – f <password file> –N <profile name>– t <gateway> |
<html> <body> JavaScript EXPRESSION Function Test Page <br><br><br> <script language="JavaScript"> <!-- function jstest2() { return ".html"; } function jstest1(one) { return one; } var dir="/images/test" var test1=jstest1(dir+"/test"+jstest2()); document.write("<a HREF="+test1+">Test</a>"); alert(test1); //--> </SCRIPT> </body> </html>
<Function type="EXPRESSION" name="jstest1" paramPatterns="y"/>
<html> <body> JavaScript EXPRESSION Function Test Page <br><br><br> <script> <!-- // various functions including psSRAPRewriter_ convert_expression appear here.//--> </SCRIPT> <script language="JavaScript"> <!-- function jstest2() { return ".html"; } function jstest1(one) { return one; } var dir="/images/test" var test1=jstest1(psSRAPRewriter_convert_ expression(dir+"/test"+jstest2()));
// The rule states that the first parameter in the function jstest1 which is of type EXPRESSION needs to be rewritten. The value of this expression is /test/images/test.html. This is prefixed with the Portal Server and the Gateway URLs.
document.write("<a HREF="+test1+">Test</a>"); alert(test1); //--> </SCRIPT> </body> </html>