Author: cbrisson
Date: Mon Mar 11 00:34:05 2019
New Revision: 1855186
URL: http://svn.apache.org/viewvc?rev=1855186&view=rev
Log:
[engine][VELOCITY-909] Merge branch 909 back to trunk
Added:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/DeprecatedRuntimeConstants.java
- copied unchanged from r1855185,
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/runtime/DeprecatedRuntimeConstants.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/DeprecationAwareExtProperties.java
- copied unchanged from r1855185,
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java/org/apache/velocity/util/DeprecationAwareExtProperties.java
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/OldPropertiesTestCase.java
- copied unchanged from r1855185,
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java/org/apache/velocity/test/OldPropertiesTestCase.java
velocity/engine/trunk/velocity-engine-core/src/test/resources/oldproperties/
- copied from r1855185,
velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/resources/oldproperties/
Modified:
velocity/engine/trunk/ (props changed)
velocity/engine/trunk/velocity-engine-core/src/main/java/ (props changed)
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/Template.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/VelocityEngine.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/IncludeEventHandler.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/AbstractContext.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeSingleton.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroFactory.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Directive.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Include.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Parse.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/ExtProperties.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/LinkingUberspector.java
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureUberspector.java
velocity/engine/trunk/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/velocity.properties
velocity/engine/trunk/velocity-engine-core/src/test/java/ (props changed)
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/BaseTestCase.java
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ClasspathResourceTestCase.java
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/CommonsExtPropTestCase.java
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ExceptionTestCase.java
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/MacroAutoReloadTestCase.java
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/MacroForwardDefineTestCase.java
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/MultiLoaderTestCase.java
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ParseWithMacroLibsTestCase.java
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/PreserveArgumentsLiteralsTestCase.java
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/SpaceGobblingTestCase.java
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/StringResourceLoaderRepositoryTestCase.java
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/StringResourceLoaderTestCase.java
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/VMLibraryTestCase.java
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity702TestCase.java
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity747TestCase.java
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/util/introspection/ConversionHandlerTestCase.java
velocity/engine/trunk/velocity-engine-core/src/test/resources/configuration/compare/output.cmp
velocity/engine/trunk/velocity-engine-core/src/test/resources/issues/velocity-747/vel.props
Propchange: velocity/engine/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Mar 11 00:34:05 2019
@@ -1,4 +1,5 @@
/velocity/engine/branches/2.0_Exp:958513,991637-995742
/velocity/engine/branches/VELOCITY-892:1844076-1854372
/velocity/engine/branches/VELOCITY-898:1843220-1843786
+/velocity/engine/branches/VELOCITY-909:1854851-1855185
/velocity/engine/trunk:992133,1032159
Propchange: velocity/engine/trunk/velocity-engine-core/src/main/java/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Mar 11 00:34:05 2019
@@ -2,4 +2,5 @@
/velocity/engine/branches/2.0_Exp/velocity-engine-core/src/main/java:958513
/velocity/engine/branches/VELOCITY-892/velocity-engine-core/src/main/java:1844076-1854372
/velocity/engine/branches/VELOCITY-898/velocity-engine-core/src/main/java:1843220-1843786
+/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/main/java:1854851-1855185
/velocity/engine/trunk/src/java:1032134
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/Template.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/Template.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/Template.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/Template.java
Mon Mar 11 00:34:05 2019
@@ -230,8 +230,7 @@ public class Template extends Resource
((SimpleNode)data).init( ica, rsvc);
- String property =
scopeName+'.'+RuntimeConstants.PROVIDE_SCOPE_CONTROL;
- provideScope = rsvc.getBoolean(property, provideScope);
+ provideScope = rsvc.isScopeControlEnabled(scopeName);
}
finally
{
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/VelocityEngine.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/VelocityEngine.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/VelocityEngine.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/VelocityEngine.java
Mon Mar 11 00:34:05 2019
@@ -26,6 +26,7 @@ import org.apache.velocity.exception.Par
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.RuntimeInstance;
+import org.apache.velocity.util.ExtProperties;
import org.slf4j.Logger;
import java.io.Reader;
@@ -153,7 +154,7 @@ public class VelocityEngine implements R
}
/**
- * Set an entire configuration at once.
+ * Set an entire configuration at once from a Properties configuration
*
* @param configuration
* @since 2.0
@@ -164,6 +165,17 @@ public class VelocityEngine implements R
}
/**
+ * Set an entire configuration at once from a named properties file
+ *
+ * @param propsFilename properties filename
+ * @since 2.1
+ */
+ public void setProperties(String propsFilename)
+ {
+ ri.setProperties(propsFilename);
+ }
+
+ /**
* Get a Velocity Runtime property.
*
* @param key property to retrieve
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/IncludeEventHandler.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/IncludeEventHandler.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/IncludeEventHandler.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/IncludeEventHandler.java
Mon Mar 11 00:34:05 2019
@@ -29,7 +29,7 @@ import org.apache.velocity.context.Conte
* @version $Id$
* @since 1.5
*/
-public interface IncludeEventHandler extends EventHandler
+public interface IncludeEventHandler extends EventHandler
{
/**
* Called when an include-type directive is encountered (
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/AbstractContext.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/AbstractContext.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/AbstractContext.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/AbstractContext.java
Mon Mar 11 00:34:05 2019
@@ -164,7 +164,7 @@ public abstract class AbstractContext ex
/*
* We always use string interning here:
* 1) speed is generally less critical when populating the context
than during parsing or rendering
- * 2) a context key is very likely to be used several times, or even a
lot of times, in the template (but does it save memory if
runtime.string.interning is false?)
+ * 2) a context key is very likely to be used several times, or even a
lot of times, in the template (but does it save memory if
runtime.string_interning is false?)
* 3) last but not least: we don't have access to RuntimeServices from
here, the reengineering would be painful...
*/
return internalPut(key.intern(), value);
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java
Mon Mar 11 00:34:05 2019
@@ -28,7 +28,8 @@ package org.apache.velocity.runtime;
* @author <a href="mailto:[email protected]">Jason van Zyl</a>
* @version $Id$
*/
-public interface RuntimeConstants
+
+public interface RuntimeConstants extends DeprecatedRuntimeConstants
{
/*
* ----------------------------------------------------------------------
@@ -51,10 +52,13 @@ public interface RuntimeConstants
String RUNTIME_LOG_NAME = "runtime.log.name";
/** Logging of invalid references. */
- String RUNTIME_LOG_REFERENCE_LOG_INVALID =
"runtime.log.invalid.references";
+ String RUNTIME_LOG_REFERENCE_LOG_INVALID =
"runtime.log.log_invalid_references";
+
+ /** Logging of invalid method calls. */
+ String RUNTIME_LOG_METHOD_CALL_LOG_INVALID =
"runtime.log.log_invalid_method_calls";
/** Whether to use string interning. */
- String RUNTIME_STRING_INTERNING = "runtime.string.interning";
+ String RUNTIME_STRING_INTERNING = "runtime.string_interning";
/*
* ----------------------------------------------------------------------
@@ -67,44 +71,63 @@ public interface RuntimeConstants
*/
/** Maximum allowed number of loops. */
- String MAX_NUMBER_LOOPS = "directive.foreach.maxloops";
+ String MAX_NUMBER_LOOPS = "directive.foreach.max_loops";
/**
* Whether to throw an exception or just skip bad iterables. Default is
true.
* @since 1.6
*/
- String SKIP_INVALID_ITERATOR = "directive.foreach.skip.invalid";
+ String SKIP_INVALID_ITERATOR = "directive.foreach.skip_invalid";
/**
* An empty object (string, collection) or zero number is false.
* @since 2.0
*/
- String CHECK_EMPTY_OBJECTS = "directive.if.emptycheck";
+ String CHECK_EMPTY_OBJECTS = "directive.if.empty_check";
/**
* Starting tag for error messages triggered by passing a parameter not
allowed in the #include directive. Only string literals,
* and references are allowed.
+ * @deprecated if/how errors are displayed is not the concern of the
engine, which should throw in all cases
*/
- String ERRORMSG_START = "directive.include.output.errormsg.start";
+ String ERRORMSG_START = "directive.include.output_error_start";
/**
* Ending tag for error messages triggered by passing a parameter not
allowed in the #include directive. Only string literals,
* and references are allowed.
+ * @deprecated if/how errors are displayed is not the concern of the
engine, which should throw in all cases
*/
- String ERRORMSG_END = "directive.include.output.errormsg.end";
+ String ERRORMSG_END = "directive.include.output_error_end";
/** Maximum recursion depth allowed for the #parse directive. */
- String PARSE_DIRECTIVE_MAXDEPTH = "directive.parse.max.depth";
+ String PARSE_DIRECTIVE_MAXDEPTH = "directive.parse.max_depth";
/** Maximum recursion depth allowed for the #define directive. */
- String DEFINE_DIRECTIVE_MAXDEPTH = "directive.define.max.depth";
+ String DEFINE_DIRECTIVE_MAXDEPTH = "directive.define.max_depth";
/**
- * Used to suppress various scope control objects.
+ * Used to suppress various scope control objects (property suffix).
* @since 1.7
+ * @deprecated use <code>context.scope_control.<scope_name> =
true/false</code>
+ * @see #CONTEXT_SCOPE_CONTROL
*/
+ @Deprecated
String PROVIDE_SCOPE_CONTROL = "provide.scope.control";
-
+
+ /**
+ * Used to enable or disable a scope control (false by default):
+ * <code>context.scope_control.<scope_name> = true/false</code>
+ * where <i>scope_name</i> is one of: <code>template, evaluate, foreach,
macro, define</code>
+ * or the name of a body macro.
+ * @since 2.1
+ */
+ String CONTEXT_SCOPE_CONTROL = "context.scope_control";
+
+ /**
+ * Vector of custom directives
+ */
+ String CUSTOM_DIRECTIVES = "runtime.custom_directives";
+
/*
* ----------------------------------------------------------------------
* 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
@@ -130,7 +153,7 @@ public interface RuntimeConstants
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";
+ String RESOURCE_MANAGER_DEFAULTCACHE_SIZE =
"resource.manager.cache.default_size";
/*
* ----------------------------------------------------------------------
@@ -139,20 +162,85 @@ public interface RuntimeConstants
*/
/** controls if the finding of a resource is logged. */
- String RESOURCE_MANAGER_LOGWHENFOUND = "resource.manager.logwhenfound";
+ String RESOURCE_MANAGER_LOGWHENFOUND = "resource.manager.log_when_found";
/**
* 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>
+ * <p>resource.loaders = file,classpath</p>
+ */
+ String RESOURCE_LOADERS = "resource.loaders";
+
+ /**
+ * Key prefix for a specific resource loader properties
+ *
+ * <p>resource.loader.file.path = ...</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 setting paths in the FileResourceLoader.
+ * (this constant is used by test cases only)
+ */
+ String FILE_RESOURCE_LOADER_PATH = "resource.loader.file.path";
/** The public handle for turning the caching on in the
FileResourceLoader. */
- String FILE_RESOURCE_LOADER_CACHE = "file.resource.loader.cache";
+ String FILE_RESOURCE_LOADER_CACHE = "resource.loader.file.cache";
+
+ /**
+ * Resource loader class property suffix
+ */
+ String RESOURCE_LOADER_CLASS = "class";
+
+ /**
+ * Resource loader instance property suffix
+ */
+ String RESOURCE_LOADER_INSTANCE = "instance";
+
+ /**
+ * Resource loader cache property suffix
+ */
+ String RESOURCE_LOADER_CACHE = "cache";
+
+ /**
+ * File resource loader paths property suffix
+ */
+ String RESOURCE_LOADER_PATHS = "path";
+
+ /**
+ * Resource loader modification check interval property suffix
+ */
+ String RESOURCE_LOADER_CHECK_INTERVAL = "modification_check_interval";
+
+ /**
+ * Datasource loader datasource url
+ */
+ String DS_RESOURCE_LOADER_DATASOURCE =
"resource.loader.ds.resource.datasource_url";
+
+ /**
+ * Datasource loader templates table
+ */
+ String DS_RESOURCE_LOADER_TABLE = "resource.loader.ds.resource.table";
+
+ /**
+ * Datasource loader template key column
+ */
+ String DS_RESOURCE_LOADER_KEY_COLUMN =
"resource.loader.ds.resource.key_column";
+
+ /**
+ * Datasource loader template content column
+ */
+ String DS_RESOURCE_LOADER_TEMPLATE_COLUMN =
"resource.loader.ds.resource.template_column";
+
+ /**
+ * Datasource loader template timestamp column
+ */
+ String DS_RESOURCE_LOADER_TIMESTAMP_COLUMN =
"resource.loader.ds.resource.timestamp_column";
+
+ /** The default character encoding for the templates. Used by the parser
in processing the input streams. */
+ String INPUT_ENCODING = "resource.default_encoding";
+
+ /** Default Encoding is UTF-8. */
+ String ENCODING_DEFAULT = "UTF-8";
/*
* ----------------------------------------------------------------------
@@ -161,28 +249,28 @@ public interface RuntimeConstants
*/
/**
- * The <code>eventhandler.referenceinsertion.class</code> property
specifies a list of the
+ * The <code>event_handler.reference_insertion.class</code> property
specifies a list of the
* {@link org.apache.velocity.app.event.ReferenceInsertionEventHandler}
implementations to use.
*/
- String EVENTHANDLER_REFERENCEINSERTION =
"eventhandler.referenceinsertion.class";
+ String EVENTHANDLER_REFERENCEINSERTION =
"event_handler.reference_insertion.class";
/**
- * The <code>eventhandler.methodexception.class</code> property specifies
a list of the
+ * The <code>event_handler.method_exception.class</code> property
specifies a list of the
* {@link org.apache.velocity.app.event.MethodExceptionEventHandler}
implementations to use.
*/
- String EVENTHANDLER_METHODEXCEPTION = "eventhandler.methodexception.class";
+ String EVENTHANDLER_METHODEXCEPTION =
"event_handler.method_exception.class";
/**
- * The <code>eventhandler.include.class</code> property specifies a list
of the
+ * The <code>event_handler.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";
+ String EVENTHANDLER_INCLUDE = "event_handler.include.class";
/**
- * The <code>eventhandler.invalidreferences.class</code> property
specifies a list of the
+ * The <code>event_handler.invalid_references.class</code> property
specifies a list of the
* {@link org.apache.velocity.app.event.InvalidReferenceEventHandler}
implementations to use.
*/
- String EVENTHANDLER_INVALIDREFERENCES =
"eventhandler.invalidreferences.class";
+ String EVENTHANDLER_INVALIDREFERENCES =
"event_handler.invalid_references.class";
/*
@@ -191,48 +279,45 @@ public interface RuntimeConstants
* ----------------------------------------------------------------------
*/
- /** Name of local Velocimacro library template. */
- String VM_LIBRARY = "velocimacro.library";
+ /** Filename of local Velocimacro library template. */
+ String VM_LIBRARY = "velocimacro.library.path";
/** Default Velocimacro library template. */
- String VM_LIBRARY_DEFAULT = "VM_global_library.vm";
+ String VM_LIBRARY_DEFAULT = "velocimacros.vtl";
/** 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";
+ String VM_PERM_ALLOW_INLINE = "velocimacro.inline.allow";
/** 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";
+ String VM_PERM_ALLOW_INLINE_REPLACE_GLOBAL =
"velocimacro.inline.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";
+ String VM_PERM_INLINE_LOCAL = "velocimacro.inline.local_scope";
/** if true, throw an exception for wrong number of arguments **/
String VM_ARGUMENTS_STRICT = "velocimacro.arguments.strict";
/**
+ * When displaying null or invalid non-quiet references, use the argument
literal reference
+ * instead of the one in the macro block. Defaults to false.
+ * @since 2.1
+ **/
+ String VM_PRESERVE_ARGUMENTS_LITERALS =
"velocimacro.arguments.preserve_literals";
+
+ /**
* Specify the maximum depth for macro calls
* @since 1.6
*/
- String VM_MAX_DEPTH = "velocimacro.max.depth";
+ 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";
-
- /**
- * When displaying null or invalid non-quiet references, use the argument
literal reference
- * instead of the one in the macro block. Defaults to false.
- * @since 2.1
- **/
- String VM_PRESERVE_ARGUMENTS_LITERALS =
"velocimacro.preserve.arguments.literals";
+ String VM_BODY_REFERENCE = "velocimacro.body_reference";
/*
* ----------------------------------------------------------------------
@@ -243,12 +328,12 @@ public interface RuntimeConstants
/**
* Properties referenced in the template are required to exist the object
*/
- String RUNTIME_REFERENCES_STRICT = "runtime.references.strict";
+ String RUNTIME_REFERENCES_STRICT = "runtime.strict_mode.enable";
/**
* Indicates we are going to use modified escape behavior in strict mode
*/
- String RUNTIME_REFERENCES_STRICT_ESCAPE =
"runtime.references.strict.escape";
+ String RUNTIME_REFERENCES_STRICT_ESCAPE = "runtime.strict_mode.escape";
/*
* ----------------------------------------------------------------------
@@ -257,13 +342,7 @@ public interface RuntimeConstants
*/
/** key name for uberspector. Multiple classnames can be specified,in
which case uberspectors will be chained. */
- String UBERSPECT_CLASSNAME = "runtime.introspector.uberspect";
-
- /** key for Conversion Manager instance */
- String CONVERSION_HANDLER_INSTANCE = "runtime.conversion.handler.instance";
-
- /** key for Conversion Manager class */
- String CONVERSION_HANDLER_CLASS = "runtime.conversion.handler.class";
+ String UBERSPECT_CLASSNAME = "introspector.uberspect.class";
/** A comma separated list of packages to restrict access to in the
SecureIntrospector. */
String INTROSPECTOR_RESTRICT_PACKAGES = "introspector.restrict.packages";
@@ -271,6 +350,11 @@ public interface RuntimeConstants
/** A comma separated list of classes to restrict access to in the
SecureIntrospector. */
String INTROSPECTOR_RESTRICT_CLASSES = "introspector.restrict.classes";
+ /** key for Conversion Manager class */
+ String CONVERSION_HANDLER_CLASS = "introspector.conversion_handler.class";
+
+ /** key for Conversion Manager instance */
+ String CONVERSION_HANDLER_INSTANCE =
"introspector.conversion_handler.instance";
/*
* ----------------------------------------------------------------------
@@ -279,19 +363,13 @@ public interface RuntimeConstants
*/
/** 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";
-
- /** Default Encoding is UTF-8. */
- String ENCODING_DEFAULT = "UTF-8";
+ String INTERPOLATE_STRINGLITERALS = "runtime.interpolate_string_literals";
/** Switch for ignoring nulls in math equations vs throwing exceptions. */
- String STRICT_MATH = "runtime.strict.math";
+ String STRICT_MATH = "runtime.strict_math";
/** Key upon which a context should be accessible within itself */
- String CONTEXT_AUTOREFERENCE_KEY = "context.autoreference.key";
+ String CONTEXT_AUTOREFERENCE_KEY = "context.self_reference_key";
/**
* The <code>parser.pool.class</code> property specifies the name of the
{@link org.apache.velocity.util.SimplePool}
@@ -314,7 +392,7 @@ public interface RuntimeConstants
* Space gobbling mode
* @since 2.0
*/
- String SPACE_GOBBLING = "space.gobbling";
+ String SPACE_GOBBLING = "parser.space_gobbling";
/**
* Space gobbling modes
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
Mon Mar 11 00:34:05 2019
@@ -62,12 +62,15 @@ import java.io.StringReader;
import java.io.Writer;
import java.util.Enumeration;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Hashtable;
+import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Properties;
+import java.util.Set;
/**
* This is the Runtime system for Velocity. It is the
@@ -174,27 +177,39 @@ public class RuntimeInstance implements
*/
private EventCartridge eventCartridge = null;
- /*
+ /**
* Whether to use string interning
*/
private boolean stringInterning = false;
- /*
- * Settings for provision of root scope for evaluate(...) calls.
+ /**
+ * Scope name for evaluate(...) calls.
*/
private String evaluateScopeName = "evaluate";
- private boolean provideEvaluateScope = false;
- /*
+ /**
+ * Scope names for which to provide scope control objects in the context
+ */
+ private Set<String> enabledScopeControls = new HashSet<String>();
+
+ /**
* Opaque reference to something specified by the
* application for use in application supplied/specified
* pluggable components
*/
private Map applicationAttributes = null;
+
+ /**
+ * Uberspector
+ */
private Uberspect uberSpect;
+
+ /**
+ * Default encoding
+ */
private String defaultEncoding;
- /*
+ /**
* Space gobbling mode
*/
private SpaceGobbling spaceGobbling;
@@ -249,7 +264,7 @@ public class RuntimeInstance implements
initializeParserPool();
initializeIntrospection();
- initializeEvaluateScopeSettings();
+ initializeScopeSettings();
/*
* initialize the VM Factory. It will use the properties
* accessible from Runtime, so keep this here at the end.
@@ -293,7 +308,7 @@ public class RuntimeInstance implements
this.initializing = false;
this.overridingProperties = null;
this.parserPool = null;
- this.provideEvaluateScope = false;
+ this.enabledScopeControls.clear();
this.resourceManager = null;
this.runtimeDirectives = new Hashtable();
this.runtimeDirectivesShared = null;
@@ -697,15 +712,7 @@ public class RuntimeInstance implements
*/
public void init(String configurationFile)
{
- try
- {
- setConfiguration(new ExtProperties(configurationFile));
- }
- catch (IOException e)
- {
- throw new VelocityException("Error reading properties from '"
- + configurationFile + "'", e);
- }
+ setProperties(configurationFile);
init();
}
@@ -1028,7 +1035,7 @@ public class RuntimeInstance implements
* now the user's directives
*/
- String[] userdirective = configuration.getStringArray("userdirective");
+ String[] userdirective =
configuration.getStringArray(CUSTOM_DIRECTIVES);
for (String anUserdirective : userdirective)
{
@@ -1252,10 +1259,19 @@ public class RuntimeInstance implements
}
}
- private void initializeEvaluateScopeSettings()
+ private void initializeScopeSettings()
{
- String property = evaluateScopeName+'.'+PROVIDE_SCOPE_CONTROL;
- provideEvaluateScope = getBoolean(property, provideEvaluateScope);
+ ExtProperties scopes = configuration.subset(CONTEXT_SCOPE_CONTROL);
+ if (scopes != null)
+ {
+ Iterator<String> scopeIterator = scopes.getKeys();
+ while (scopeIterator.hasNext())
+ {
+ String scope = scopeIterator.next();
+ boolean enabled = scopes.getBoolean(scope);
+ if (enabled) enabledScopeControls.add(scope);
+ }
+ }
}
/**
@@ -1395,7 +1411,7 @@ public class RuntimeInstance implements
try
{
- if (provideEvaluateScope)
+ if (isScopeControlEnabled(evaluateScopeName))
{
Object previous = ica.get(evaluateScopeName);
context.put(evaluateScopeName, new Scope(this, previous));
@@ -1426,7 +1442,7 @@ public class RuntimeInstance implements
finally
{
ica.popCurrentTemplateName();
- if (provideEvaluateScope)
+ if (isScopeControlEnabled(evaluateScopeName))
{
Object obj = ica.get(evaluateScopeName);
if (obj instanceof Scope)
@@ -1527,7 +1543,7 @@ public class RuntimeInstance implements
/**
* Returns a <code>Template</code> from the resource manager.
* This method assumes that the character encoding of the
- * template is set by the <code>input.encoding</code>
+ * template is set by the <code>resource.default_encoding</code>
* property. The default is UTF-8.
*
* @param name The file name of the desired template.
@@ -1856,4 +1872,15 @@ public class RuntimeInstance implements
{
return hyphenAllowedInIdentifiers;
}
+
+ /**
+ * Get whether to provide a scope control object for this scope
+ * @param scopeName
+ * @return scope control enabled
+ * @since 2.1
+ */
+ public boolean isScopeControlEnabled(String scopeName)
+ {
+ return enabledScopeControls.contains(scopeName);
+ }
}
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java
Mon Mar 11 00:34:05 2019
@@ -469,8 +469,17 @@ public interface RuntimeServices
SpaceGobbling getSpaceGobbling();
/**
- * get whether hyphens are allowed in identifiers
+ * Get whether hyphens are allowed in identifiers
* @return configured boolean flag
+ * @since 2.1
*/
boolean isHyphenAllowedInIdentifiers();
+
+ /**
+ * Get whether to provide a scope control object for this scope
+ * @param scopeName
+ * @return scope control enabled
+ * @since 2.1
+ */
+ boolean isScopeControlEnabled(String scopeName);
}
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeSingleton.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeSingleton.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeSingleton.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeSingleton.java
Mon Mar 11 00:34:05 2019
@@ -157,6 +157,17 @@ public class RuntimeSingleton implements
}
/**
+ * Set an entire configuration at once from a named properties file
+ *
+ * @param propsFilename properties filename
+ * @since 2.1
+ */
+ public static void setProperties(String propsFilename)
+ {
+ ri.setProperties(propsFilename);
+ }
+
+ /**
* Add a property to the configuration. If it already
* exists then the value stated here will be added
* to the configuration entry. For example, if
@@ -258,7 +269,7 @@ public class RuntimeSingleton implements
/**
* Returns a <code>Template</code> from the resource manager.
* This method assumes that the character encoding of the
- * template is set by the <code>input.encoding</code>
+ * template is set by the <code>resource.default_encoding</code>
* property. The default is UTF-8.
*
* @param name The file name of the desired template.
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroFactory.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroFactory.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroFactory.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroFactory.java
Mon Mar 11 00:34:05 2019
@@ -158,7 +158,16 @@ public class VelocimacroFactory
}
else
{
- log.debug("Default library not found.");
+ // try the old default library
+ log.debug("Default library {} not found. Trying old
default library: {}", RuntimeConstants.VM_LIBRARY_DEFAULT,
DeprecatedRuntimeConstants.OLD_VM_LIBRARY_DEFAULT);
+ if
(rsvc.getLoaderNameForResource(RuntimeConstants.OLD_VM_LIBRARY_DEFAULT) != null)
+ {
+ libfiles = RuntimeConstants.OLD_VM_LIBRARY_DEFAULT;
+ }
+ else
+ {
+ log.debug("Old default library {} not found.",
DeprecatedRuntimeConstants.OLD_VM_LIBRARY_DEFAULT);
+ }
}
}
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Directive.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Directive.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Directive.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Directive.java
Mon Mar 11 00:34:05 2019
@@ -160,8 +160,7 @@ public abstract class Directive implemen
rsvc = rs;
log = rsvc.getLog("directive." + getName());
- String property =
getScopeName()+'.'+RuntimeConstants.PROVIDE_SCOPE_CONTROL;
- this.provideScope = rsvc.getBoolean(property, provideScope);
+ provideScope = rsvc.isScopeControlEnabled(getScopeName());
}
/**
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Include.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Include.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Include.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Include.java
Mon Mar 11 00:34:05 2019
@@ -287,6 +287,7 @@ public class Include extends InputBase
* @param writer
* @param msg
* @throws IOException
+ * @deprecated if/how errors are displayed is not the concern of the
engine, which should throw in all cases
*/
private void outputErrorToStream( Writer writer, String msg )
throws IOException
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Parse.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Parse.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Parse.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Parse.java
Mon Mar 11 00:34:05 2019
@@ -55,7 +55,7 @@ import java.util.List;
* content.
*
* 2) There is a limited parse depth. It is set as a property
- * "directive.parse.max.depth = 10" by default. This 10 deep
+ * "directive.parse.max_depth = 10" by default. This 10 deep
* limit is a safety feature to prevent infinite loops.
* </pre>
*
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMethod.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
Mon Mar 11 00:34:05 2019
@@ -60,6 +60,7 @@ public class ASTMethod extends SimpleNod
private String methodName = "";
private int paramCount = 0;
+ private boolean logOnInvalid = true;
protected Info uberInfo;
@@ -120,6 +121,7 @@ public class ASTMethod extends SimpleNod
paramCount = jjtGetNumChildren() - 1;
strictRef =
rsvc.getBoolean(RuntimeConstants.RUNTIME_REFERENCES_STRICT, false);
+ logOnInvalid =
rsvc.getBoolean(RuntimeConstants.RUNTIME_LOG_METHOD_CALL_LOG_INVALID, true);
cleanupParserAndTokens();
@@ -165,8 +167,8 @@ public class ASTMethod extends SimpleNod
VelMethod method = ClassUtils.getMethod(methodName, params,
paramClasses,
o, context, this, strictRef);
- // warn if method wasn't found (if strictRef is true, then ClassUtils
did thorw an exception)
- if (o != null && method == null)
+ // warn if method wasn't found (if strictRef is true, then ClassUtils
did throw an exception)
+ if (o != null && method == null && logOnInvalid)
{
StringBuilder plist = new StringBuilder();
for (int i = 0; i < params.length; i++)
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
Mon Mar 11 00:34:05 2019
@@ -34,7 +34,6 @@ import org.apache.commons.lang3.StringUt
import org.slf4j.Logger;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Vector;
@@ -70,7 +69,7 @@ public class ResourceManagerImpl
* This is a list of the template input stream source initializers,
basically properties for a particular template stream
* source. The order in this list reflects numbering of the properties i.e.
*
- * <p><loader-id>.resource.loader.<property> =
<value></p>
+ * <p>resource.loader.<loader-id>.<property> =
<value></p>
*/
private final List<ExtProperties> sourceInitializerList = new
ArrayList<>();
@@ -117,8 +116,8 @@ public class ResourceManagerImpl
* in as an instance.
*/
- String loaderClass =
StringUtils.trim(configuration.getString("class"));
- ResourceLoader loaderInstance = (ResourceLoader)
configuration.get("instance");
+ String loaderClass =
StringUtils.trim(configuration.getString(RuntimeConstants.RESOURCE_LOADER_CLASS));
+ ResourceLoader loaderInstance = (ResourceLoader)
configuration.get(RuntimeConstants.RESOURCE_LOADER_INSTANCE);
if (loaderInstance != null)
{
@@ -128,9 +127,9 @@ public class ResourceManagerImpl
resourceLoader = ResourceLoaderFactory.getLoader(rsvc,
loaderClass);
} else
{
- String msg = "Unable to find '" +
+ String msg = "Unable to find 'resource.loader." +
configuration.getString(RuntimeConstants.RESOURCE_LOADER_IDENTIFIER) +
- ".resource.loader.class' specification in configuration." +
+ ".class' specification in configuration." +
" This is a critical value. Please adjust configuration.";
log.error(msg);
throw new VelocityException(msg);
@@ -209,22 +208,22 @@ public class ResourceManagerImpl
*/
private void assembleResourceLoaderInitializers()
{
- Vector resourceLoaderNames =
rsvc.getConfiguration().getVector(RuntimeConstants.RESOURCE_LOADER);
+ Vector resourceLoaderNames =
rsvc.getConfiguration().getVector(RuntimeConstants.RESOURCE_LOADERS);
for (ListIterator<String> it = resourceLoaderNames.listIterator();
it.hasNext(); )
{
/*
* The loader id might look something like the following:
*
- * file.resource.loader
+ * resource.loader.file
*
* The loader id is the prefix used for all properties
* pertaining to a particular loader.
*/
String loaderName = StringUtils.trim(it.next());
it.set(loaderName);
- StringBuilder loaderID = new StringBuilder(loaderName);
- loaderID.append(".").append(RuntimeConstants.RESOURCE_LOADER);
+ StringBuilder loaderID = new StringBuilder();
+
loaderID.append(RuntimeConstants.RESOURCE_LOADER).append('.').append(loaderName);
ExtProperties loaderConfiguration =
rsvc.getConfiguration().subset(loaderID.toString());
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ClasspathResourceLoader.java
Mon Mar 11 00:34:05 2019
@@ -46,10 +46,10 @@ import java.io.Reader;
* other than specifying this as the loader to use. For example
* the following is all that the loader needs to be functional:
* <br>
- * <br>
- * resource.loader = class
- * class.resource.loader.class =
- * org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
+ * <pre><code>
+ * resource.loaders = class
+ * resource.loader.class.class
=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
+ * </code></pre>
* <br>
* <br>
* To use, put your template directories, jars
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java
Mon Mar 11 00:34:05 2019
@@ -21,6 +21,7 @@ package org.apache.velocity.runtime.reso
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.exception.VelocityException;
+import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.resource.Resource;
import org.apache.velocity.util.ExtProperties;
@@ -40,84 +41,86 @@ import java.sql.SQLException;
import java.sql.Timestamp;
/**
- * <P>This is a simple template file loader that loads templates
- * from a DataSource instead of plain files.
+ * <p>This is a simple template file loader that loads templates
+ * from a DataSource instead of plain files.</p>
*
- * <P>It can be configured with a datasource name, a table name,
+ * <p>It can be configured with a datasource name, a table name,
* id column (name), content column (the template body) and a
- * datetime column (for last modification info).
+ * datetime column (for last modification info).</p>
* <br>
+ * <p>Example configuration snippet for velocity.properties:</p>
* <br>
- * Example configuration snippet for velocity.properties:
- * <br>
- * <br>
- * resource.loader = file, ds <br>
- * <br>
- * ds.resource.loader.public.name = DataSource <br>
- * ds.resource.loader.description = Velocity DataSource Resource Loader <br>
- * ds.resource.loader.class =
org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader <br>
- * ds.resource.loader.resource.datasource = java:comp/env/jdbc/Velocity <br>
- * ds.resource.loader.resource.table = tb_velocity_template <br>
- * ds.resource.loader.resource.keycolumn = id_template <br>
- * ds.resource.loader.resource.templatecolumn = template_definition <br>
- * ds.resource.loader.resource.timestampcolumn = template_timestamp <br>
- * ds.resource.loader.cache = false <br>
- * ds.resource.loader.modificationCheckInterval = 60 <br>
- * <br>
- * <P>Optionally, the developer can instantiate the DataSourceResourceLoader
and set the DataSource via code in
- * a manner similar to the following:
- * <BR>
- * <BR>
- * DataSourceResourceLoader ds = new DataSourceResourceLoader();<BR>
- * ds.setDataSource(DATASOURCE);<BR>
- * Velocity.setProperty("ds.resource.loader.instance",ds);<BR>
- * <P> The property <code>ds.resource.loader.class</code> should be left out,
otherwise all the other
- * properties in velocity.properties would remain the same.
- * <BR>
- * <BR>
+ * <pre><code>
+ * resource.loaders = file, ds
*
- * Example WEB-INF/web.xml: <br>
- * <br>
- * <resource-ref> <br>
- * <description>Velocity template DataSource</description> <br>
- * <res-ref-name>jdbc/Velocity</res-ref-name> <br>
- * <res-type>javax.sql.DataSource</res-type> <br>
- * <res-auth>Container</res-auth> <br>
- * </resource-ref> <br>
- * <br>
+ * resource.loader.ds.description = Velocity DataSource Resource Loader <br>
+ * resource.loader.ds.class =
org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader <br>
+ * resource.loader.ds.resource.datasource_url = java:comp/env/jdbc/Velocity
<br>
+ * resource.loader.ds.resource.table = tb_velocity_template <br>
+ * resource.loader.ds.resource.key_column = id_template <br>
+ * resource.loader.ds.resource.template_column = template_definition <br>
+ * resource.loader.ds.resource.timestamp_column = template_timestamp <br>
+ * resource.loader.ds.cache = false <br>
+ * resource.loader.ds.modification_check_interval = 60 <br>
+ * </code></pre>
+ * <p>Optionally, the developer can instantiate the DataSourceResourceLoader
and set the DataSource via code in
+ * a manner similar to the following:</p>
+ * <br>
+ * <pre><code>
+ * DataSourceResourceLoader ds = new DataSourceResourceLoader();
+ * ds.setDataSource(DATASOURCE);
+ * Velocity.setProperty("resource.loader.ds.instance",ds);
+ * </code></pre>
+ * <p> The property <code>resource.loader.ds.class</code> should be left out,
otherwise all the other
+ * properties in velocity.properties would remain the same.</p>
+ * <br>
+ * <p>Example WEB-INF/web.xml:</p>
+ * <br>
+ * <pre><code>
+ * <resource-ref>
+ * <description>Velocity template DataSource</description>
+ * <res-ref-name>jdbc/Velocity</res-ref-name>
+ * <res-type>javax.sql.DataSource</res-type>
+ * <res-auth>Container</res-auth>
+ * </resource-ref>
+ * </code></pre>
* <br>
* and Tomcat 4 server.xml file: <br>
- * [...] <br>
- * <Context path="/exampleVelocity" docBase="exampleVelocity" debug="0"> <br>
- * [...] <br>
- * <ResourceParams name="jdbc/Velocity"> <br>
- * <parameter> <br>
- * <name>driverClassName</name> <br>
- * <value>org.hsql.jdbcDriver</value> <br>
- * </parameter> <br>
- * <parameter> <br>
- * <name>driverName</name> <br>
- * <value>jdbc:HypersonicSQL:database</value> <br>
- * </parameter> <br>
- * <parameter> <br>
- * <name>user</name> <br>
- * <value>database_username</value> <br>
- * </parameter> <br>
- * <parameter> <br>
- * <name>password</name> <br>
- * <value>database_password</value> <br>
- * </parameter> <br>
- * </ResourceParams> <br>
- * [...] <br>
- * </Context> <br>
- * [...] <br>
- * <br>
- * Example sql script:<br>
- * CREATE TABLE tb_velocity_template ( <br>
- * id_template varchar (40) NOT NULL , <br>
- * template_definition text (16) NOT NULL , <br>
- * template_timestamp datetime NOT NULL <br>
- * ) <br>
+ * <pre><code>
+ * [...]
+ * <Context path="/exampleVelocity" docBase="exampleVelocity" debug="0">
+ * [...]
+ * <ResourceParams name="jdbc/Velocity">
+ * <parameter>
+ * <name>driverClassName</name>
+ * <value>org.hsql.jdbcDriver</value>
+ * </parameter>
+ * <parameter>
+ * <name>driverName</name>
+ * <value>jdbc:HypersonicSQL:database</value>
+ * </parameter>
+ * <parameter>
+ * <name>user</name>
+ * <value>database_username</value>
+ * </parameter>
+ * <parameter>
+ * <name>password</name>
+ * <value>database_password</value>
+ * </parameter>
+ * </ResourceParams>
+ * [...]
+ * </Context>
+ * [...]
+ * </code></pre>
+ * <br>
+ * <p>Example sql script:</p>
+ * <pre><code>
+ * CREATE TABLE tb_velocity_template (
+ * id_template varchar (40) NOT NULL ,
+ * template_definition text (16) NOT NULL ,
+ * template_timestamp datetime NOT NULL
+ * );
+ * </code></pre>
*
* @author <a href="mailto:[email protected]">Will Glass-Husain</a>
* @author <a href="mailto:[email protected]">Matt Raible</a>
@@ -181,11 +184,11 @@ public class DataSourceResourceLoader ex
*/
public void init(ExtProperties configuration)
{
- dataSourceName =
StringUtils.trim(configuration.getString("resource.datasource"));
+ dataSourceName =
StringUtils.trim(configuration.getString("datasource_url"));
tableName =
StringUtils.trim(configuration.getString("resource.table"));
- keyColumn =
StringUtils.trim(configuration.getString("resource.keycolumn"));
- templateColumn =
StringUtils.trim(configuration.getString("resource.templatecolumn"));
- timestampColumn =
StringUtils.trim(configuration.getString("resource.timestampcolumn"));
+ keyColumn =
StringUtils.trim(configuration.getString("resource.key_column"));
+ templateColumn =
StringUtils.trim(configuration.getString("resource.template_column"));
+ timestampColumn =
StringUtils.trim(configuration.getString("resource.timestamp_column"));
if (dataSource != null)
{
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java
Mon Mar 11 00:34:05 2019
@@ -21,6 +21,7 @@ package org.apache.velocity.runtime.reso
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.exception.VelocityException;
+import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.resource.Resource;
import org.apache.velocity.util.ExtProperties;
@@ -72,7 +73,7 @@ public class FileResourceLoader extends
{
log.trace("FileResourceLoader: initialization starting.");
- paths.addAll( configuration.getVector("path") );
+ paths.addAll(
configuration.getVector(RuntimeConstants.RESOURCE_LOADER_PATHS) );
// trim spaces from all paths
for (ListIterator<String> it = paths.listIterator(); it.hasNext(); )
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java
Mon Mar 11 00:34:05 2019
@@ -21,6 +21,7 @@ package org.apache.velocity.runtime.reso
import org.apache.velocity.exception.ResourceNotFoundException;
import org.apache.velocity.exception.VelocityException;
+import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.resource.Resource;
import org.apache.velocity.util.ExtProperties;
@@ -45,14 +46,14 @@ import java.util.Map;
* You simply add the JarResourceLoader to the configuration via
* </p>
* <p><pre>
- * resource.loader = jar
- * jar.resource.loader.class =
org.apache.velocity.runtime.resource.loader.JarResourceLoader
- * jar.resource.loader.path = list of JAR <URL>s
+ * resource.loaders = jar
+ * resource.loader.jar.class =
org.apache.velocity.runtime.resource.loader.JarResourceLoader
+ * resource.loader.jar.path = list of JAR <URL>s
* </pre></p>
*
* <p> So for example, if you had a jar file on your local filesystem, you
could simply do
* <pre>
- * jar.resource.loader.path = jar:file:/opt/myfiles/jar1.jar
+ * resource.loader.jar.path = jar:file:/opt/myfiles/jar1.jar
* </pre>
* </p>
* <p> Note that jar specification for the <code>.path</code> configuration
property
@@ -91,7 +92,7 @@ public class JarResourceLoader extends R
{
log.trace("JarResourceLoader: initialization starting.");
- List paths = configuration.getList("path");
+ List paths =
configuration.getList(RuntimeConstants.RESOURCE_LOADER_PATHS);
if (paths != null)
{
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java
Mon Mar 11 00:34:05 2019
@@ -92,23 +92,23 @@ public abstract class ResourceLoader
try
{
- isCachingOn = configuration.getBoolean("cache", false);
+ isCachingOn =
configuration.getBoolean(RuntimeConstants.RESOURCE_LOADER_CACHE, false);
}
catch (Exception e)
{
isCachingOn = false;
- String msg = "Exception parsing cache setting: " +
configuration.getString("cache");
+ String msg = "Exception parsing cache setting: " +
configuration.getString(RuntimeConstants.RESOURCE_LOADER_CACHE);
log.error(msg, e);
throw new VelocityException(msg, e);
}
try
{
- modificationCheckInterval =
configuration.getLong("modificationCheckInterval", 0);
+ modificationCheckInterval =
configuration.getLong(RuntimeConstants.RESOURCE_LOADER_CHECK_INTERVAL, 0);
}
catch (Exception e)
{
modificationCheckInterval = 0;
- String msg = "Exception parsing modificationCheckInterval setting:
" + configuration.getString("modificationCheckInterval");
+ String msg = "Exception parsing modificationCheckInterval setting:
" + RuntimeConstants.RESOURCE_LOADER_CHECK_INTERVAL;
log.error(msg, e);
throw new VelocityException(msg, e);
}
@@ -119,7 +119,7 @@ public abstract class ResourceLoader
className = ResourceCacheImpl.class.getName();
try
{
- className = configuration.getString("class", className);
+ className =
configuration.getString(RuntimeConstants.RESOURCE_LOADER_CLASS, className);
}
catch (Exception e)
{
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java
Mon Mar 11 00:34:05 2019
@@ -49,10 +49,11 @@ import java.util.Map;
* if not provided, the factory will fall back on using
* {@link StringResourceRepositoryImpl} as the default.
* <pre>
- * resource.loader = string
- * string.resource.loader.description = Velocity StringResource loader
- * string.resource.loader.class =
org.apache.velocity.runtime.resource.loader.StringResourceLoader
- * string.resource.loader.repository.class =
org.apache.velocity.runtime.resource.loader.StringResourceRepositoryImpl
+ * resource.loaders = string
+ * resource.loader.string.description = Velocity StringResource loader
+ * resource.loader.string.class =
org.apache.velocity.runtime.resource.loader.StringResourceLoader
+ * resource.loader.string.repository.name = MyRepositoryName (optional, to
avoid using the default repository)
+ * resource.loader.string.repository.class =
org.apache.velocity.runtime.resource.loader.StringResourceRepositoryImpl
* </pre>
* Resources can be added to the repository like this:
* <pre><code>
@@ -66,7 +67,7 @@ import java.util.Map;
* After this, the templates can be retrieved as usual.
* <br>
* <p>If there will be multiple StringResourceLoaders used in an application,
- * you should consider specifying a 'string.resource.loader.repository.name =
foo'
+ * you should consider specifying a 'resource.loader.string.repository.name =
foo'
* property in order to keep you string resources in a non-default repository.
* This can help to avoid conflicts between different frameworks or components
* that are using StringResourceLoader.
@@ -78,7 +79,7 @@ import java.util.Map;
* </p>
* <p>If you have concerns about memory leaks or for whatever reason do not
wish
* to have your string repository stored statically as a class member, then you
- * should set 'string.resource.loader.repository.static = false' in your
properties.
+ * should set 'resource.loader.string.repository.static = false' in your
properties.
* This will tell the resource loader that the string repository should be
stored
* in the Velocity application attributes. To retrieve the repository, do:
* <pre><code>
@@ -103,7 +104,7 @@ import java.util.Map;
* repo.magicallyAddSomeStringResources();
* velocityEngine.setApplicationAttribute("foo", repo);
* </code></pre>
- * Then, assuming the 'string.resource.loader.repository.name' property is
+ * Then, assuming the 'resource.loader.string.repository.name' property is
* set to 'some.name', the StringResourceLoader will use that already created
* repository, rather than creating a new one.
* </p>
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/ExtProperties.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/ExtProperties.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/ExtProperties.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/ExtProperties.java
Mon Mar 11 00:34:05 2019
@@ -30,7 +30,6 @@ import java.nio.charset.StandardCharsets
import java.security.AccessController;
import java.util.ArrayList;
import java.util.Enumeration;
-import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
@@ -151,9 +150,9 @@ import java.util.Vector;
* @author <a href="mailto:[email protected]">Henning P. Schmiedehausen</a>
* @author <a href="mailto:[email protected]">Claude Brisson</a>
*/
-public class ExtProperties extends Hashtable<String,Object>
+@SuppressWarnings("deprecation")
+public class ExtProperties extends DeprecationAwareExtProperties
{
-
/**
* Default configurations repository.
*/
@@ -212,7 +211,7 @@ public class ExtProperties extends Hasht
* you wish to perform operations with configuration
* information in a particular order.
*/
- protected ArrayList keysAsListed = new ArrayList();
+ protected ArrayList<String> keysAsListed = new ArrayList<String>();
protected final static String START_TOKEN="${";
protected final static String END_TOKEN="}";
@@ -733,11 +732,11 @@ public class ExtProperties extends Hasht
* exists then the value stated here will be added
* to the configuration entry. For example, if
*
- * <code>resource.loader = file</code>
+ * <code>resource.loaders = file</code>
*
* is already present in the configuration and you
*
- * <code>addProperty("resource.loader", "classpath")</code>
+ * <code>addProperty("resource.loaders", "classpath")</code>
*
* Then you will end up with a Vector like the
* following:
@@ -791,7 +790,7 @@ public class ExtProperties extends Hasht
// safety check
if (!containsKey(key))
{
- keysAsListed.add(key);
+ keysAsListed.add(translateKey(key));
}
put(key, value);
}
@@ -832,7 +831,7 @@ public class ExtProperties extends Hasht
// brand new key - store in keysAsListed to retain order
if (!containsKey(key))
{
- keysAsListed.add(key);
+ keysAsListed.add(translateKey(key));
}
put(key, value);
}
@@ -930,6 +929,7 @@ public class ExtProperties extends Hasht
*/
public void clearProperty(String key)
{
+ key = translateKey(key);
if (containsKey(key))
{
// we also need to rebuild the keysAsListed or else
@@ -952,7 +952,7 @@ public class ExtProperties extends Hasht
*
* @return an Iterator over the keys
*/
- public Iterator getKeys()
+ public Iterator<String> getKeys()
{
return keysAsListed.iterator();
}
@@ -964,16 +964,16 @@ public class ExtProperties extends Hasht
* @param prefix the prefix to match
* @return an Iterator of keys that match the prefix
*/
- public Iterator getKeys(String prefix)
+ public Iterator<String> getKeys(String prefix)
{
- Iterator keys = getKeys();
- ArrayList matchingKeys = new ArrayList();
+ Iterator<String> keys = getKeys();
+ ArrayList<String> matchingKeys = new ArrayList();
while (keys.hasNext())
{
- Object key = keys.next();
+ String key = keys.next();
- if (key instanceof String && ((String) key).startsWith(prefix))
+ if (key.startsWith(prefix))
{
matchingKeys.add(key);
}
@@ -2085,5 +2085,4 @@ public class ExtProperties extends Hasht
}
return c;
}
-
}
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/LinkingUberspector.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/LinkingUberspector.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/LinkingUberspector.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/LinkingUberspector.java
Mon Mar 11 00:34:05 2019
@@ -23,7 +23,7 @@ import java.util.Iterator;
/**
* <p>
- * When the runtime.introspection.uberspect configuration property contains
several
+ * When the introspector.uberspect.class configuration property contains
several
* uberspector class names, it means those uberspectors will be chained. When
an
* uberspector in the list other than the leftmost does not implement
ChainableUberspector,
* then this utility class is used to provide a basic default chaining where
the
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureUberspector.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureUberspector.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureUberspector.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureUberspector.java
Mon Mar 11 00:34:05 2019
@@ -31,7 +31,7 @@ import java.util.Iterator;
*
* <p>To use this introspector, set the following property:
* <pre>
- * runtime.introspector.uberspect =
org.apache.velocity.util.introspection.SecureUberspector
+ * introspector.uberspect.class =
org.apache.velocity.util.introspection.SecureUberspector
* </pre>
*
* @author <a href="mailto:[email protected]">Will Glass-Husain</a>
Modified:
velocity/engine/trunk/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/velocity.properties
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/velocity.properties?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/velocity.properties
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/main/resources/org/apache/velocity/runtime/defaults/velocity.properties
Mon Mar 11 00:34:05 2019
@@ -19,20 +19,14 @@
# This controls whether invalid references are logged.
# ----------------------------------------------------------------------------
-runtime.log.invalid.references = true
-
-# ----------------------------------------------------------------------------
-# T E M P L A T E E N C O D I N G
-# ----------------------------------------------------------------------------
-
-input.encoding=UTF-8
+runtime.log.log_invalid_references = true
# ----------------------------------------------------------------------------
# Strings interning
# ----------------------------------------------------------------------------
# Set to true to optimize memory, to false to optimize speed
-runtime.string.interning = true
+runtime.string_interning = true
# ----------------------------------------------------------------------------
# F O R E A C H P R O P E R T I E S
@@ -41,7 +35,7 @@ runtime.string.interning = true
# is -1, which means there is no limit.
# ----------------------------------------------------------------------------
-directive.foreach.maxloops = -1
+directive.foreach.max_loops = -1
# ----------------------------------------------------------------------------
# I F P R O P E R T I E S
@@ -50,23 +44,13 @@ directive.foreach.maxloops = -1
# as long as zero numbers, do evaluate to false.
# ----------------------------------------------------------------------------
-directive.if.emptycheck = true
-
-# ----------------------------------------------------------------------------
-# I N C L U D E P R O P E R T I E S
-# ----------------------------------------------------------------------------
-# These are the properties that governed the way #include'd content
-# is governed.
-# ----------------------------------------------------------------------------
-
-directive.include.output.errormsg.start = <!-- include error :
-directive.include.output.errormsg.end = see error log -->
+directive.if.empty_check = true
# ----------------------------------------------------------------------------
# P A R S E P R O P E R T I E S
# ----------------------------------------------------------------------------
-directive.parse.max.depth = 10
+directive.parse.max_depth = 10
# ----------------------------------------------------------------------------
# S C O P E P R O P E R T I E S
@@ -77,12 +61,12 @@ directive.parse.max.depth = 10
# for most of these is false. Note that <bodymacroname> should be replaced by
# name of macros that take bodies for which you want to suppress the scope.
# ----------------------------------------------------------------------------
-# template.provide.scope.control = false
-# evaluate.provide.scope.control = false
-foreach.provide.scope.control = true
-# macro.provide.scope.control = false
-# define.provide.scope.control = false
-# <bodymacroname>.provide.scope.control = false
+# context.scope_control.template = false
+# context.scope_control.evaluate = false
+context.scope_control.foreach = true
+# context.scope_control.macro = false
+# context.scope_control.define = false
+# context.scope_control.<bodymacroname> = false
# ----------------------------------------------------------------------------
# T E M P L A T E L O A D E R S
@@ -91,13 +75,15 @@ foreach.provide.scope.control = true
#
# ----------------------------------------------------------------------------
-resource.loader = file
+resource.default_encoding=UTF-8
-file.resource.loader.description = Velocity File Resource Loader
-file.resource.loader.class =
org.apache.velocity.runtime.resource.loader.FileResourceLoader
-file.resource.loader.path = .
-file.resource.loader.cache = false
-file.resource.loader.modificationCheckInterval = 2
+resource.loaders = file
+
+resource.loader.file.description = Velocity File Resource Loader
+resource.loader.file.class =
org.apache.velocity.runtime.resource.loader.FileResourceLoader
+resource.loader.file.path = .
+resource.loader.file.cache = false
+resource.loader.file.modification_check_interval = 2
# ----------------------------------------------------------------------------
# VELOCIMACRO PROPERTIES
@@ -108,10 +94,10 @@ file.resource.loader.modificationCheckIn
# ----------------------------------------------------------------------------
# velocimacro.library = VM_global_library.vm
-velocimacro.permissions.allow.inline = true
-velocimacro.permissions.allow.inline.to.replace.global = false
-velocimacro.permissions.allow.inline.local.scope = false
-velocimacro.max.depth = 20
+velocimacro.inline.allow = true
+velocimacro.inline.replace_global = false
+velocimacro.inline.local_scope = false
+velocimacro.max_depth = 20
# ----------------------------------------------------------------------------
# VELOCIMACRO STRICT MODE
@@ -129,7 +115,7 @@ velocimacro.arguments.strict = false
# Defines name of the reference that can be used to render the AST block
passed to
# block macro call as an argument inside a macro.
# ----------------------------------------------------------------------------
-velocimacro.body.reference=bodyContent
+velocimacro.body_reference = bodyContent
# ----------------------------------------------------------------------------
# VELOCIMACRO PRESERVE ARGUMENTS LITERALS
@@ -138,7 +124,7 @@ velocimacro.body.reference=bodyContent
# which is not quiet, it will print the provided literal reference instead
# of the one found in the body of the macro
# ----------------------------------------------------------------------------
-velocimacro.preserve.arguments.literals = false
+velocimacro.arguments.preserve_literals = false
# ----------------------------------------------------------------------------
@@ -148,10 +134,9 @@ velocimacro.preserve.arguments.literals
# that are not defined in the context, or have not been defined
# with a #set directive. This setting will also throw an exception
# if an attempt is made to call a non-existing property on an object
-# or if the object is null. When this property is true then property
-# 'directive.set.null.allowed' is also set to true.
+# or if the object is null.
# ----------------------------------------------------------------------------
-runtime.references.strict = false
+runtime.strict_mode.enable = false
# ----------------------------------------------------------------------------
# INTERPOLATION
@@ -159,7 +144,7 @@ runtime.references.strict = false
# turn off and on interpolation of references and directives in string
# literals. ON by default :)
# ----------------------------------------------------------------------------
-runtime.interpolate.string.literals = true
+runtime.interpolate_string_literals = true
# ----------------------------------------------------------------------------
@@ -190,10 +175,10 @@ parser.pool.size = 20
# class property is actually a comma-separated list of classes (which will
# be called in order).
# ----------------------------------------------------------------------------
-# eventhandler.referenceinsertion.class =
-# eventhandler.nullset.class =
-# eventhandler.methodexception.class =
-# eventhandler.include.class =
+# event_handler.reference_insertion.class =
+# event_handler.invalid_reference.class =
+# event_handler.method_exception.class =
+# event_handler.include.class =
# ----------------------------------------------------------------------------
@@ -202,7 +187,7 @@ parser.pool.size = 20
# Allows alternative introspection and all that can of worms brings.
# ----------------------------------------------------------------------------
-runtime.introspector.uberspect =
org.apache.velocity.util.introspection.UberspectImpl
+introspector.uberspect.class =
org.apache.velocity.util.introspection.UberspectImpl
# ----------------------------------------------------------------------------
# CONVERSION HANDLER
@@ -210,8 +195,8 @@ runtime.introspector.uberspect = org.apa
# Sets the data types Conversion Handler used by the default uberspector
# ----------------------------------------------------------------------------
-runtime.conversion.handler.class =
org.apache.velocity.util.introspection.TypeConversionHandlerImpl
-
+introspector.conversion_handler.class =
org.apache.velocity.util.introspection.TypeConversionHandlerImpl
+1
# ----------------------------------------------------------------------------
# SECURE INTROSPECTOR
@@ -247,7 +232,7 @@ introspector.restrict.classes = java.lan
# Possible values: none, bc (aka Backward Compatible), lines, structured
# ----------------------------------------------------------------------------
-space.gobbling = lines
+parser.space_gobbling = lines
# ----------------------------------------------------------------------------
# HYPHEN IN IDENTIFIERS
Propchange: velocity/engine/trunk/velocity-engine-core/src/test/java/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Mar 11 00:34:05 2019
@@ -2,5 +2,6 @@
/velocity/engine/branches/2.0_Exp/velocity-engine-core/src/test/java:958513,991637-995742
/velocity/engine/branches/VELOCITY-892/velocity-engine-core/src/test/java:1844076-1854372
/velocity/engine/branches/VELOCITY-898/velocity-engine-core/src/test/java:1843220-1843786
+/velocity/engine/branches/VELOCITY-909/velocity-engine-core/src/test/java:1854851-1855185
/velocity/engine/trunk/src/test:1032134
/velocity/engine/trunk/velocity-engine-core/src/test/java:992133,1032159
Modified:
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/BaseTestCase.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/BaseTestCase.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/BaseTestCase.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/BaseTestCase.java
Mon Mar 11 00:34:05 2019
@@ -29,7 +29,6 @@ import org.apache.velocity.runtime.resou
import org.apache.velocity.test.misc.TestLogger;
import java.io.File;
-import java.io.FileReader;
import java.io.IOException;
import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
@@ -72,7 +71,7 @@ public abstract class BaseTestCase exten
ret.setProperty(RuntimeConstants.RUNTIME_LOG_INSTANCE, log);
// use string resource loader by default, instead of file
- ret.setProperty(RuntimeConstants.RESOURCE_LOADER, "file,string");
+ ret.setProperty(RuntimeConstants.RESOURCE_LOADERS, "file,string");
ret.addProperty("string.resource.loader.class",
StringResourceLoader.class.getName());
ret.addProperty("string.resource.loader.repository.name",
stringRepoName);
ret.addProperty("string.resource.loader.repository.static", "false");
Modified:
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ClasspathResourceTestCase.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ClasspathResourceTestCase.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ClasspathResourceTestCase.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ClasspathResourceTestCase.java
Mon Mar 11 00:34:05 2019
@@ -80,7 +80,7 @@ public class ClasspathResourceTestCase e
assureResultsDirectoryExists(RESULTS_DIR);
Velocity.reset();
- Velocity.setProperty(Velocity.RESOURCE_LOADER, "classpath");
+ Velocity.setProperty(Velocity.RESOURCE_LOADERS, "classpath");
/*
* I don't think I should have to do this, these should
Modified:
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/CommonsExtPropTestCase.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/CommonsExtPropTestCase.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/CommonsExtPropTestCase.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/CommonsExtPropTestCase.java
Mon Mar 11 00:34:05 2019
@@ -87,10 +87,10 @@ public class CommonsExtPropTestCase exte
showIterator(result, c.getKeys());
message(result, "Testing retrieval of CSV values ...");
- showVector(result, c.getVector("resource.loader"));
+ showVector(result, c.getVector("resource.loaders"));
message(result, "Testing subset(prefix).getKeys() ...");
- ExtProperties subset = c.subset("file.resource.loader");
+ ExtProperties subset = c.subset("resource.loader.file");
showIterator(result, subset.getKeys());
message(result, "Testing getVector(prefix) ...");
Modified:
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ExceptionTestCase.java
URL:
http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ExceptionTestCase.java?rev=1855186&r1=1855185&r2=1855186&view=diff
==============================================================================
---
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ExceptionTestCase.java
(original)
+++
velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ExceptionTestCase.java
Mon Mar 11 00:34:05 2019
@@ -96,7 +96,7 @@ public class ExceptionTestCase extends B
throws Exception
{
ve = new VelocityEngine();
- ve.setProperty(RuntimeConstants.RESOURCE_LOADER,"except");
+ ve.setProperty(RuntimeConstants.RESOURCE_LOADERS,"except");
ve.setProperty("except.resource.loader.class",ExceptionGeneratingResourceLoader.class.getName());
try
{