Velocity Precompiler Configuration
Velocity 2.0 introduced some syntax changes that require updates to existing templates. The Velcocity Precompiler configuration enables auto correction of common 1.x patterns in templates to 2.0 syntax. Patterns and Replacement strings are in Regular Expression syntax. Template sources are left unchanged, however Velocity Macro files are updated with the 2.0 syntax.
Additional patterns and replacements can be added to this properties file using the pattern.NUMBER and matching replace.NUMBER pattern. Patterns and Replacements must be RegEx formatted and escaped / Java Properties file formatted and escaped Strings.
If your templates have already been converted to 2.0 syntax. You may turn off the precompiler to avoid the extra and unnecesary performance hit at assembly time by setting the autocorrect property to false.
Configuration Location: <InstallDir>/rxconfig/Server/velocity-precompile.properties
Property | Default Value | Description |
autocorrect | true | When true or missing, the Auto Correct feature is turned on and all patterns within this configuration file will be applied as part of a pre-compile setp before being passed to the Velocity Engine. When false, the precompile step is skipped. |
autoFixMacroFiles | true | When true or missing, this feature will Auto Correct and update any Velocity Macro (*.vm) files deployed in the <installDir>/sys_resources/vm folder or under the <installDir>/rx_resources/vm folder. Setting this property to false will prevent ao correction of macros. |
addtrailingspaceforlastpound | true | When true or missing will add a trailing space to Velocity Macro files or Templates that end with the # or $ character. This is to work around a defect in Velocity where the parser will fail to load a template or macro file that is 100% comments. |
pattern.1 | "#" | Searches for any strings that match "#" in template sources and replaces them with the value of replace.1 |
replace.1 | '#' | The replacement for strings in Templates that match pattern.1 |
pattern.2 | "\\$" | Looks for any strings that match "$" in Templates and replaces that with replace.2 |
replace.2 | '\\$' | Replaces "$" with '$'. |
pattern.3 | \\$velocityCount | Search Templates for references to the obsolete $velocityCount variable and replaces them with $foreach.count |
replace.3 | \\$foreach.count | The replacement string for $velocityCount |
pattern.4 | \\$velocityHasNext | Search templates for the obsolete $velocityHasNext variable |
replace.4 | \\$foreach.hasNext() | Replace $velocityHasNext with $foreach.hasNext() |