Previous Page: Rewrite Filter Support  

Rewrite Filter Configuration

Rewrite filter (rewrite.nlm) configuration is accomplished via text files. An example of a configuration file is given below:

[Name=oraclefilter]

[Extension]
html, htm

[URL]
sjf-siva.sjf.novell.com/oracle/*
sjf-siva.sjf.novell.com/database/OracleQuery.html
sjf-siva.sjf.novell.com/oraclereports/

[Replace]
var xsport    ="9003"<<>> var xsport    ="443"
var xsname     ="xyz01"<<>> var xsname    ="www"
var xconnectMode = "http"<<>> var xconnectMode = "https"
<PARAM name=serverHost   value="xyz01.novell.com"><<>><PARAM name=serverHost  value="www.novell.com">
<PARAM name=serverPort  value="9003"><<>><PARAM name=serverPort  value="443">
<PARAM name=connectMode  value="https"><<>><PARAM name=connectMode  value="http"

[Name=<filtername>]: This is the name of the rewriter filter. It is used for filter identification in rwfilter commands.

[Extension]: The user can specify file extensions (in a single line) which need to be parsed. This section is optional, but if this section is not specified, all extension types will be parsed. Specifying this section will result in the parsing only specified extensions.

Conditions: All extensions should be specified in a single line (just after the Extensions section header). Individual extension elements should be separated by a comma.

For example:

[Extension]
html

Parses files with html extensions.
Parses http://www.novell.com/index.html.

Does not parse http://www.novell.com/logo.gif.
Does not parse http://www.novell.com.

[Extension]
html, htm, txt,  ,

Parses files with extensions html, htm, txt, and any default files implied by a trailing slash (/).
Parses http://www.novell.com/license.txt.
Parses http://www.novell.com/.
Does not parse http://www.novell.com/logo.gif.

[URL]: This section lists all URLs to be parsed. The rules of URL specification are similar to the ACLCheck module as follows:

www.novell.com: Exact match
www.novell.com/contact/: All files in contact directory, but not in subdirectories.
www.novell.com/contact/*: All URLs starting with www.novell.com/contact, including subdirectories of contact.

[Replace]: The user can specify replacement pairs in this section. The string "<<>>" is used as a separator between the original string an the new string. The format is as follows:

[Replace]
<search string><<>><replacement string>

All the lines afer this Replacement section header will be treated as replacement string pairs, so this should be the last section in the file.

Conditions: The Replace section should be the last one in the file. Each replacement pair (including the last one) must be terminated with the end of the line.


Usage

The name of the filter module is REWRITE.NLM. Configuration files could be supplied as command line parameters to filter.

Filename restrictions: Rewrite.nlm does not place any restrictions on the configuration filename format, but files which do not conform to DOS filename format (8.3) format) could cause errors while loading the file.

Load Time Command Line Options: The load time command line option is: rewrite -s -f system/accell.rw -f etc/accel2.rw.

Options:


Runtime Console Commands

The following runtime console commands are also implemented:


Replacement Rules

The following are simple rules that the iChain rewrite filter uses:

  1. String replacement is done as a single pass.
  2. String replacement is not performed recursively. For example:

    [Replace]
    DOG<<>>CAT
    A<<>>O

    If the original string is DOG, the rewritten string will be CAT. That is, only one replacement will occur (CAT will not be further replaced with CAT).

  3. Since string replacement is done in one pass, the string that matches first will take precedence. For example:

    [Replace]
    ABC<<>>XYZ
    BCDEF<<>>PQRSTUVWXYZ

    If the original string is ABCDEFGH, the replaced string is XYZDEFGH.

  4. If two user-specified strings match the data portion, the original string of higher length will be used for replacement except in cases detailed in point 3 above. For example:

    [Replace]
    ABC<<>>XYZ
    ABCDEF<<>>PQRSTUVWXYZ

    If the original string is ABCDEFGH, the replaced string looks like PQRSTUVWXYZGH.

  5. The rewrite filter module, REWRITE.NLM, applies only one matching filter (each configuration filter file constitutes a filter) for a request. If multiple filters match a request URL, the matching filter that was configured most recently will be used for data parsing.


  Previous Page: Rewrite Filter Support