Sun GlassFish Web Space Server 10.0 Secure Web Access Add-On Guide

Sample for XML Attributes

ProcedureTo Use the XML Attributes Sample

  1. This sample can be accessed from:

    portal-server-URL/rewriter/XML/attrib.html

  2. Add the rule specified in this sample (if it does not already exist) to the default_gateway_ruleset in the section "Rules for Rewriting XML Source".

  3. Edit the default_gateway_ruleset in the Rewriter service under the Portal Server Configuration in the Portal Server administration console.

  4. Restart the Gateway:


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

XML Before Rewriting

<html>
RW_START
<body>
<xml>
<baseroot href="/root.html"/>
</xml>
<xml>
<img href="image.html"/>
</xml>
<xml>
<string href="1234|substring.html"/>
</xml>
<xml>
<check href="1234|string.html"/>
</xml>
</body>
RW_END
</html>

Rule

<Attribute name="href" tag="check" valuePatterns="1234|"/>

HTML After Rewriting

<html>
Rewriting starts
<br>
<br>
<body>
<xml><baseroot href="/root.html"/></xml>
<xml><img href="image.html"/></xml>
<xml><string href="1234|substring.html"/></xml>
<xml><check href="1234|gateway-URL/portal-server-URL
/rewriter/XML/string.html"/></xml>

// This statement is rewritten because it matches the conditions specified in the rule. The Attribute name is href, tag is check and the valuePatterns is 1234. The string following valuePatterns is rewritten. See Using Pattern Matching in Rules for details on valuePatterns.

</body>
Rewriting ends
</html>