Velocity.properties Configuration Instructions

Source: Internet
Author: User

1.Runtime Log

Runtime.log = Velocity.log

To specify the path strength and log file name of the Velocity runtime log files, such as the absolute path that is not fully qualified, the system will think of the current directory.

Runtime.log.logsystem

This parameter does not have a default value, it can specify a custom log processing object that implements the interface Org.apache.velocity.runtime.log.LogSystem to velocity. This makes it easy to unify Velocity with your own system of log mechanisms.

Runtime.log.logsystem.class = Org.apache.velocity.runtime.log.AvalonLogSystem

The above line, is an example to specify a logger.

Runtime.log.error.stacktrace = False Runtime.log.warn.stacktrace = False Runtime.log.info.stacktrace = False These are error message traces Switch. A large amount of verbose log content output will be generated.

Runtime.log.invalid.references = True

When a reference is invalid, open the log output. This is an effective and useful debugging tool in the production system operation.

2. Character Set encoding issues

input.encoding = iso-8859-1

The encoding method of the output template (templates). You can choose how to encode your template, such as UTF-8. GBK.

output.encoding = iso-8859-1

Velocityservlet the encoding of the output stream (outputs streams).

3. #foreach () Directive

Directive.foreach.counter.name = Velocitycount

When using the #foreach () directive in a template, the string name set here will be used as the context key to represent the counter name in the loop, as set above, which can be accessed through $velocityCount in the template.

Directive.foreach.counter.initial.value = 1

The starting value of the counter in #foreach ().

4. #include () and #parse () Directive

Directive.include.output.errormsg.start =

Directive.include.output.errormsg.end =

When using # include (), define the start and end error message tokens in the internal flow, and if both are set, the error message will be output to the stream '. But must be both defined.

Directive.parse.maxdepth = 10 Defines the parsing depth of the template, which prevents recursion parsing when parsing another template with #parse () indication in a template.

5. Resource Management

Resource.manager.logwhenfound = True

Define the ' found ' switch in the log. When open, such as when ResourceManager first discovers a resource, the initial time, Theresource name and classname of the loader That found it'll be noted in the runtime log.

Resource.loader = <name> (default = File)

(You can have multiple values separated by the. number), which you can understand as the extension of the specified resource file.

<name>.loader.description = Velocity File Resource Loader

Describes the resource loader name.

<name>.resource.loader.class = The class name of the resource loader implemented by Org.apache.velocity.runtime.resource.loader.FileResourceLoader. The default is the file loader.

<name>.resource.loader.path =.

Multi-valued key.   would acceptcsv for value.  The root directory of the resource location. The current configuration uses Fileresourceloader and Jarresourceloader to traverse all files in the directory to find resources.

<name>.resource.loader.cache = False Controls whether the loader caches files. Default is not saved for easy development and debugging. In the production environment (productiondeployment) can be set to true to improve performance, where the parameter modificationcheckinterval should be set to a valid value-to determine how long reload.

<name>.resource.loader.modificationcheckinterval = 2

When the caching is turned on, this value in seconds indicates how often the system detects if the template has been modified to determine whether it is needed, and if set to <= 0, Velocity will not be detected.

Complete example of default parameters for Fileresourceloader:

Resource.loader = File

file.resource.loader.description = Velocity File Resource Loader

File.resource.loader.class = Org.apache.velocity.runtime.resource.loader.FileResourceLoaderfile.resource.loader.path =.

File.resource.loader.cache = Falsefile.resource.loader.modificationCheckInterval = 2

6.Velocima CRO (Macro configuration)

Velocimacro.library = VM_GLOBAL_LIBRARY.VM

Multi-valued key. Will acceptcsv for value. The file name containing the macro code library to be loaded when the Velocity engine is running. All templates have access to macros (Velocimacros). This file location is relative to the root directory of the resource file.

Velocimacro.permissions.allow.inline = True

Determines of thedefinition of new Velocimacros via The#macro () directive in templates

Isallowed, defines whether a new macro is defined in the template using the #macro () directive. The default is true, which means that all templates can be defined

New Velocimacros. Note that this setting, such as the one in the template, may replace the global macro definition.

Velocimacro.permissions.allow.inline.to.replace.global = False

Controls whether user-defined macros can replace the Velocity's macro library.

Velocimacro.permissions.allow.inline.local.scope = False

Controls the private namespace of the macros in the template. When True, a template #macro () directive can only be defined by its template

Access. This means that all the macros can not be shared, of course, will not want to disturb, replace.

Velocimacro.context.localscope = False Control Velocimacro reference Access (Set/get) is related to context

The range is still only in the current velocimacro.

Velocimacro.library.autoreload = False

Controls whether the macro library is automatically loaded. When set to true, the source of the Velocimacro will be modified according to whether the need to reLoad, it is convenient to debug, do not need to restart your server, such as with the parameter File.resource.loader.cache = False settings, mainly In order to facilitate the development of debugging.

7. Semantic changes

Runtime.interpolate.string.literals = True

Controls interpolation mechanism of the VTL String literals. Note that A-VTL stringliteral is specifically the astring using doublequotes that's used in a #set () statement, a method

Call of a reference, Aparameter to a VMS, or as an argument to a VTL directive in general. See the VTL reference for further information.

8. Run-time configuration

Parser.pool.size = 20

Control velocity startup is the number of template parsers that need to be created and put in the pool----this is just preinstalled.  The default of 20 is sufficient for the average user. Even if the value is small, Velocity will be dynamically increased as the system needs it (but the increased

into the pool). When added, the information is output in the log.

Velocity.properties Configuration Instructions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.