在 Velocity.jar 中RuntimeConstants 中定义了 velocity.properties中配置的所有key
/** * This class defines the keys that are used in the velocity.properties file so that they can be referenced as a constant within * Java code. * * @author <a href="mailto:jon@latchkey.com">Jon S. Stevens</a> * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a> * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a> * @version $Id: RuntimeConstants.java 806601 2009-08-21 15:30:38Z nbubna $ */ public interface RuntimeConstants { /* * ---------------------------------------------------------------------- * These are public constants that are used as handles for the * properties that can be specified in your typical * velocity.properties file. * ---------------------------------------------------------------------- */ /* * ---------------------------------------------------------------------- * L O G G I N G C O N F I G U R A T I O N * ---------------------------------------------------------------------- */ /** Location of the velocity log file. */ String RUNTIME_LOG = "runtime.log"; /** externally provided logger. */ String RUNTIME_LOG_LOGSYSTEM = "runtime.log.logsystem"; /** class of log system to use. */ String RUNTIME_LOG_LOGSYSTEM_CLASS = "runtime.log.logsystem.class"; /** * Properties referenced in the template are required to exist the object */ String RUNTIME_REFERENCES_STRICT = "runtime.references.strict"; /** * Indicates we are going to use modifed escape behavior in strict mode */ String RUNTIME_REFERENCES_STRICT_ESCAPE = "runtime.references.strict.escape"; /** * @deprecated This appears to have always been meaningless. */ String RUNTIME_LOG_ERROR_STACKTRACE = "runtime.log.error.stacktrace"; /** * @deprecated The functionality this controlled is confusing and no longer necessary. */ String RUNTIME_LOG_WARN_STACKTRACE = "runtime.log.warn.stacktrace"; /** * @deprecated This appears to have always been meaningless. */ String RUNTIME_LOG_INFO_STACKTRACE = "runtime.log.info.stacktrace"; /** Logging of invalid references. */ String RUNTIME_LOG_REFERENCE_LOG_INVALID = "runtime.log.invalid.references"; /** * @deprecated Use LogChute.TRACE_PREFIX instead */ String TRACE_PREFIX = " [trace] "; /** * @deprecated Use LogChute.DEBUG_PREFIX instead */ String DEBUG_PREFIX = " [debug] "; /** * @deprecated Use LogChute.INFO_PREFIX instead */ String INFO_PREFIX = " [info] "; /** * @deprecated Use LogChute.WARN_PREFIX instead */ String WARN_PREFIX = " [warn] "; /** * @deprecated Use LogChute.ERROR_PREFIX instead */ String ERROR_PREFIX = " [error] "; /** * @deprecated This will be removed in a future version */ String UNKNOWN_PREFIX = " [unknown] "; /* * ---------------------------------------------------------------------- * D I R E C T I V E C O N F I G U R A T I O N * ---------------------------------------------------------------------- * Directive properties are of the form: * * directive.<directive-name>.<property> * ---------------------------------------------------------------------- */ /** Counter reference name in #foreach directives. */ String COUNTER_NAME = "directive.foreach.counter.name"; /** * Iterator.hasNext() reference name in #foreach directives. * @since 1.6 */ String HAS_NEXT_NAME = "directive.foreach.iterator.name"; /** Initial counter value in #foreach directives. */ String COUNTER_INITIAL_VALUE = "directive.foreach.counter.initial.value"; /** Maximum allowed number of loops. */ String MAX_NUMBER_LOOPS = "directive.foreach.maxloops"; /** * Whether to throw an exception or just skip bad iterables. Default is true. * @since 1.6 */ String SKIP_INVALID_ITERATOR = "directive.foreach.skip.invalid"; /** if set to true then allows #set to accept null values in the right hand side. */ String SET_NULL_ALLOWED = "directive.set.null.allowed"; /** * Indicates if toString() should be called during #if condition evaluation * just to ensure it does not return null. Check is unnecessary if all * toString() implementations are known to have non-null return values. * Disabling the check (like Velocity 1.5 did) will can boost performance * since toString() may be a complex operation on large objects. * @since 1.6 */ String DIRECTIVE_IF_TOSTRING_NULLCHECK = "directive.if.tostring.nullcheck"; /** * Starting tag for error messages triggered by passing a parameter not allowed in the #include directive. Only string literals, * and references are allowed. */ String ERRORMSG_START = "directive.include.output.errormsg.start"; /** * Ending tag for error messages triggered by passing a parameter not allowed in the #include directive. Only string literals, * and references are allowed. */ String ERRORMSG_END = "directive.include.output.errormsg.end"; /** Maximum recursion depth allowed for the #parse directive. */ String PARSE_DIRECTIVE_MAXDEPTH = "directive.parse.max.depth"; /** Maximum recursion depth allowed for the #define directive. */ String DEFINE_DIRECTIVE_MAXDEPTH = "directive.define.max.depth"; /** * class to use for local context with #evaluate() * @since 1.6 */ String EVALUATE_CONTEXT_CLASS = "directive.evaluate.context.class"; /** * Used to suppress various scope control objects. * @since 1.7 */ String PROVIDE_SCOPE_CONTROL = "provide.scope.control"; /* * ---------------------------------------------------------------------- * R E S O U R C E M A N A G E R C O N F I G U R A T I O N * ---------------------------------------------------------------------- */ /** */ String RESOURCE_MANAGER_CLASS = "resource.manager.class"; /** * The <code>resource.manager.cache.class</code> property specifies the name of the * {@link org.apache.velocity.runtime.resource.ResourceCache} implementation to use. */ String RESOURCE_MANAGER_CACHE_CLASS = "resource.manager.cache.class"; /** The <code>resource.manager.cache.size</code> property specifies the cache upper bound (if relevant). */ String RESOURCE_MANAGER_DEFAULTCACHE_SIZE = "resource.manager.defaultcache.size"; /* * ---------------------------------------------------------------------- * R E S O U R C E L O A D E R C O N F I G U R A T I O N * ---------------------------------------------------------------------- */ /** controls if the finding of a resource is logged. */ String RESOURCE_MANAGER_LOGWHENFOUND = "resource.manager.logwhenfound"; /** * Key used to retrieve the names of the resource loaders to be used. In a properties file they may appear as the following: * * <p>resource.loader = file,classpath</p> */ String RESOURCE_LOADER = "resource.loader"; /** The public handle for setting a path in the FileResourceLoader. */ String FILE_RESOURCE_LOADER_PATH = "file.resource.loader.path"; /** The public handle for turning the caching on in the FileResourceLoader. */ String FILE_RESOURCE_LOADER_CACHE = "file.resource.loader.cache"; /* * ---------------------------------------------------------------------- * E V E N T H A N D L E R C O N F I G U R A T I O N * ---------------------------------------------------------------------- */ /** * The <code>eventhandler.referenceinsertion.class</code> property specifies a list of the * {@link org.apache.velocity.app.event.ReferenceInsertionEventHandler} implementations to use. */ String EVENTHANDLER_REFERENCEINSERTION = "eventhandler.referenceinsertion.class"; /** * The <code>eventhandler.nullset.class</code> property specifies a list of the * {@link org.apache.velocity.app.event.NullSetEventHandler} implementations to use. */ String EVENTHANDLER_NULLSET = "eventhandler.nullset.class"; /** * The <code>eventhandler.methodexception.class</code> property specifies a list of the * {@link org.apache.velocity.app.event.MethodExceptionEventHandler} implementations to use. */ String EVENTHANDLER_METHODEXCEPTION = "eventhandler.methodexception.class"; /** * The <code>eventhandler.include.class</code> property specifies a list of the * {@link org.apache.velocity.app.event.IncludeEventHandler} implementations to use. */ String EVENTHANDLER_INCLUDE = "eventhandler.include.class"; /** * The <code>eventhandler.invalidreferences.class</code> property specifies a list of the * {@link org.apache.velocity.app.event.InvalidReferenceEventHandler} implementations to use. */ String EVENTHANDLER_INVALIDREFERENCES = "eventhandler.invalidreferences.class"; /* * ---------------------------------------------------------------------- * V E L O C I M A C R O C O N F I G U R A T I O N * ---------------------------------------------------------------------- */ /** Name of local Velocimacro library template. */ String VM_LIBRARY = "velocimacro.library"; /** Default Velocimacro library template. */ String VM_LIBRARY_DEFAULT = "VM_global_library.vm"; /** switch for autoloading library-sourced VMs (for development). */ String VM_LIBRARY_AUTORELOAD = "velocimacro.library.autoreload"; /** boolean (true/false) default true : allow inline (in-template) macro definitions. */ String VM_PERM_ALLOW_INLINE = "velocimacro.permissions.allow.inline"; /** boolean (true/false) default false : allow inline (in-template) macro definitions to replace existing. */ String VM_PERM_ALLOW_INLINE_REPLACE_GLOBAL = "velocimacro.permissions.allow.inline.to.replace.global"; /** Switch for forcing inline macros to be local : default false. */ String VM_PERM_INLINE_LOCAL = "velocimacro.permissions.allow.inline.local.scope"; /** Switch for VM blather : default true. */ String VM_MESSAGES_ON = "velocimacro.messages.on"; /** switch for local context in VM : default false. */ String VM_CONTEXT_LOCALSCOPE = "velocimacro.context.localscope"; /** if true, throw an exception for wrong number of arguments **/ String VM_ARGUMENTS_STRICT = "velocimacro.arguments.strict"; /** * Specify the maximum depth for macro calls * @since 1.6 */ String VM_MAX_DEPTH = "velocimacro.max.depth"; /** * Defines name of the reference that can be used to get the AST block passed to block macro calls. * @since 1.7 */ String VM_BODY_REFERENCE = "velocimacro.body.reference"; /* * ---------------------------------------------------------------------- * G E N E R A L R U N T I M E C O N F I G U R A T I O N * ---------------------------------------------------------------------- */ /** Switch for the interpolation facility for string literals. */ String INTERPOLATE_STRINGLITERALS = "runtime.interpolate.string.literals"; /** The character encoding for the templates. Used by the parser in processing the input streams. */ String INPUT_ENCODING = "input.encoding"; /** Encoding for the output stream. Currently used by Anakia and VelocityServlet */ String OUTPUT_ENCODING = "output.encoding"; /** Default Encoding is ISO-8859-1. */ String ENCODING_DEFAULT = "ISO-8859-1"; /** key name for uberspector. Multiple classnames can be specified,in which case uberspectors will be chained. */ String UBERSPECT_CLASSNAME = "runtime.introspector.uberspect"; /** A comma separated list of packages to restrict access to in the SecureIntrospector. */ String INTROSPECTOR_RESTRICT_PACKAGES = "introspector.restrict.packages"; /** A comma separated list of classes to restrict access to in the SecureIntrospector. */ String INTROSPECTOR_RESTRICT_CLASSES = "introspector.restrict.classes"; /** Switch for ignoring nulls in math equations vs throwing exceptions. */ String STRICT_MATH = "runtime.strict.math"; /** * The <code>parser.pool.class</code> property specifies the name of the {@link org.apache.velocity.util.SimplePool} * implementation to use. */ String PARSER_POOL_CLASS = "parser.pool.class"; /** * @see #NUMBER_OF_PARSERS */ String PARSER_POOL_SIZE = "parser.pool.size"; /* * ---------------------------------------------------------------------- * These constants are used internally by the Velocity runtime i.e. * the constants listed below are strictly used in the Runtime * class itself. * ---------------------------------------------------------------------- */ /** Default Runtime properties. */ String DEFAULT_RUNTIME_PROPERTIES = "org/apache/velocity/runtime/defaults/velocity.properties"; /** Default Runtime properties. */ String DEFAULT_RUNTIME_DIRECTIVES = "org/apache/velocity/runtime/defaults/directive.properties"; /** * The default number of parser instances to create. Configurable via the parameter named by the {@link #PARSER_POOL_SIZE} * constant. */ int NUMBER_OF_PARSERS = 20;
相关推荐
- **resources** 目录:可能存储 Velocity 配置文件(如 `velocity.properties`),以及应用中使用的资源文件。 - **src/main/java** 目录:包含 Velocity 相关的 Java 类,如控制器、模型类和 velocity 工具类。 - ...
Struts2通过配置文件或注解来定义Action和结果映射,实现灵活的请求处理流程。 **Velocity模板引擎** Velocity强调的是"分离关注点",即模板语言与编程语言分开,提供了一种简单的方式来动态生成HTML或其他类型的...
- 初始化Velocity:在Java代码中,使用`Velocity.init()`方法初始化Velocity引擎,并加载配置文件。 - 设置上下文:通过`VelocityContext`对象将Java对象添加到上下文中,以便在模板中使用。 - 渲染模板:调用`...
通过这个"velocity示例",你可以学习到如何配置Velocity引擎,创建Context,加载模板,以及如何在模板中使用VTL来动态生成内容。这只是一个基础的起点,随着深入学习,你会发现Velocity可以应用于更复杂的Web应用和...
在这个“Velocity之HelloWorld配置”中,我们将深入探讨如何设置和运行一个简单的Velocity HelloWorld示例。 首先,让我们了解Velocity的基本工作原理。Velocity使用一种称为模板的语言,它允许在HTML或XML文档中...
在提供的`VelocityDemo`文件中,可能包含了实现这个功能的示例代码,包括JSP页面、Velocity模板文件、以及相关的Java后台处理类。通过研究这个示例,你可以更好地理解如何将JSP和Velocity结合,实现在Word模板上的...
文件列表中没有具体的文件名称,但通常会包含`pom.xml`配置文件,以及`src/main/resources/templates`目录下的Velocity模板文件。项目可能还包含一些Java类,这些类负责提供数据给Velocity模板渲染。通过分析这些...
SpringMVC3与Velocity...这只是一个基础的配置示例,实际项目中可能需要考虑更多高级特性,如国际化、缓存、模板继承等。不断学习和实践,可以让你更深入地掌握SpringMVC和Velocity的使用,提高开发效率和产品质量。
在`demo`这个文件中,可能包含了上述步骤的示例代码或者配置文件。通过学习和理解这个示例,开发者可以快速掌握如何在Spring Boot项目中运用Velocity进行代码生成,从而提升开发效率。 总的来说,SpringBoot集成...
接下来,配置Velocity的关键在于设置模板文件的路径和相关属性。在`application.properties`文件中,你可以指定VM文件(Velocity模板文件)的存放目录,例如: ```properties velocityUrl=D:\\velocity ``` 然后,...
在这个例子工程中,我们不会遇到Velocity的XML配置文件,这意味着所有设置和指令都将直接在Java代码或Velocity模板中完成,这简化了学习和调试过程。 **1. Velocity模板语言基础** Velocity模板语言(VTL)是...
此外,可能还包含了一些配置文件,如struts.xml,展示了如何配置Struts2的Action和Result。 学习和理解Struts2与Velocity的整合,可以帮助开发者更好地掌握Java Web应用的开发流程,提升项目的可维护性和开发效率。...
4. 代码生成:在一些自动化工具或构建系统中,Velocity用于生成源代码或配置文件。 ** 使用Velocity的注意事项 ** 1. 避免在模板中使用复杂的逻辑,因为Velocity主要是为了分离逻辑和展示,过于复杂的逻辑应该放在...
这个"generator插件完整配置文件"正是实现这一功能的关键。 首先,我们需要了解Generator插件的基本工作原理。Generator通常是一个基于模板引擎的代码生成器,它通过读取数据库中的表结构信息,结合预定义的模板...
这两个指令属于Velocity Tools的扩展,如果你的项目中引入了Velocity Tools,可以通过在`velocity.properties`文件中添加以下配置来启用它们: ```properties userdirective = org.apache.velocity.tools.generic....
配置文件通常为 `velocity.properties`,其中包含了如模板路径、缓存策略、日志设置等关键参数。 **4. 自定义指令和工具** Velocity 允许开发者注册自定义指令,扩展其功能。这些自定义指令可以是简单的函数,也...
4. 配置Velocity:在Spring配置文件中添加VelocityViewResolver,指定模板目录和Velocity工具类。 5. 编写Controller:使用SpringMVC的@Controller注解创建控制器类,定义处理HTTP请求的方法,注入Service层的Bean。...
通过官方文档,开发者可以获得关于Velocity配置、使用模式、API等全面的信息。 6. Velocity的使用模式: 文档提到了基本使用模式,这意味着Velocity提供了一套基本的使用方式,包括模板定义、数据绑定以及渲染输出...
工程中的`Vt`可能是Velocity工具类或者配置文件,这通常包含了Velocity引擎的初始化设置,例如: - 指定模板目录,使得引擎知道在哪里查找模板文件。 - 设置编码,确保模板文件的读取和输出符合预期的字符集。 - ...