By default, Highlighter can fetch a document for from any URL provided (
uri parameter of the web service). To avoid overhead of reading documents over HTTP, you can setup Highlighter to map received document URLs to local file system path.
The serving of local files is controlled by
allowFileReadForMappedUri flag and the
uriMappings section that may list one or more transformation rules. For example:
The following options are supported by the transformation rule:
searchPattern- Regex expression for matching input URI. By default, matching is case sensitive. To ignore case, start your pattern with
(?i). (You can use this online tool to test your expressions.)
replacement- Regex replacement.
last- By default, transformation completes with the first pattern matching input URI. When set to false, this option tells Highlighter to apply transformation and continues with the next rule.
replaceFirst- Set to true to replace only the first pattern match.
urlDecode- Set to true to the URL-decode text. If this option is specified in the same rule with search/replace options, the string will be decoded after the replacement is done (if searchPattern matches).
Note that for Windows file paths, we are using forward slashes instead of backslashes. (Single backslash is used as an escape character so we would have to use double backslashes to prevent config file related errors.)