Ruleset validation
A copy of RuleSet.xsd is provided in the catalog folder and should be used to validate a ruleset file before registering it in the catalog.ini file. Note that Image Serving uses an internal copy of RuleSet.xsd for validation.
URL pre-processing
Before any other processing, an incoming HTTP request is partially parsed to determine which image catalog should be applied. Once the catalog is identified, the rule set for the selected catalog (or the default catalog, if no specific catalog was identified) is applied.
The <rule>
elements are searched in the order specified for a match with the contents of the <expression>
element ( expression
).
If a <rule>
is matched, the optional substitution
is applied and the modified request string is passed to the server’s request parser for normal processing.
If no successful match is made when the end of the <ruleset>
is reached, the request is passed to the parser without modification.
The OnMatch attribute
The default behavior can be modified with the OnMatch
attribute of the <rule>
element. OnMatch
may be set to break
(default), continue
, or error
.
Overriding catalog attributes
The rule
element can optionally define attributes that override the corresponding catalog attributes when the rule is successfully matched. If multiple matched rules set the same attribute, the last one prevails. See rule element for a list of attributes that can be controlled with rules.
Regular expressions
Simple string matching works for very basic applications, but regular expressions are required in most instances. While regular expressions are industry-standard, the specific implementation varies from instance to instance.
package java.util.regexdescribes the specific regular expression implementation used by Image Serving.
Captured substrings
To facilitate complex URL modifications, substrings may be captured in the expression by enclosing the substring with parentheses (…). Captured substrings are numbered sequentially starting with 1 according to the position of the leading parenthesis. The captured substrings may be inserted in the substitution using $ *
n*
, where n
is the sequence number of the captured substring.
Managing rule set files
One rule set file can be attached to each image catalog with the catalog attribute attribute::RuleSetFile
. While you can edit the rule set file any time, the image server recognizes the changes only when the associated image catalog is reloaded. This reloading happens when the platform server is started or restarted and whenever the primary catalog file, which has an .ini file suffix, is modified or “touched” to change the file date.