Author: cbrisson
Date: Tue Nov 8 13:30:56 2016
New Revision: 1768688
URL: http://svn.apache.org/viewvc?rev=1768688&view=rev
Log:
[site] fix broken urls towards tools.xml svn resources, and add a section about
generic tools usage
Modified:
velocity/site/cms/trunk/content/tools/devel/generic.mdtext
velocity/site/cms/trunk/content/tools/devel/struts.mdtext
velocity/site/cms/trunk/content/tools/devel/view.mdtext
Modified: velocity/site/cms/trunk/content/tools/devel/generic.mdtext
URL:
http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/tools/devel/generic.mdtext?rev=1768688&r1=1768687&r2=1768688&view=diff
==============================================================================
--- velocity/site/cms/trunk/content/tools/devel/generic.mdtext (original)
+++ velocity/site/cms/trunk/content/tools/devel/generic.mdtext Tue Nov 8
13:30:56 2016
@@ -4,9 +4,57 @@ Title: Apache Velocity Tools - Generic T
GenericTools is the set of classes that provide basic infrastructure for using
tools in standard Java SE Velocity projects, as well as a set of tools for use
in generic Velocity templates. These tools have no Java EE dependencies and are
often safe to use as "singletons". Some of them are not thread-safe to allow
both a no-arg constructor and configurability, but the state-changing methods
are declared protected with the exception of configure(Map) which is--by
default--rendered useless after being used just once. If you require strict
thread-safety, be cautious in using any configurable tools and consider
[restricting the abilities of template
authors](http://wiki.apache.org/velocity/BuildingSecureWebApplications) to
prevent circumvention of the lockdown placed on configuration methods.
+## Usage
+
++ Initialization with only standard generic tools, using the default
configuration file:
+
+ /* Create tools initialization properties */
+ Map<String, Object> properties = new HashMap<String, Object>();
+ /* RenderTool needs to know the VelocityEngine. Setting the engine
will also set the logger. */
+ properties.put("engine", engine);
+ /* If the render tool is not to be used, you can instead just set the
logger if needed as follow:
+ *
+ * properties.put("log", logger);
+ *
+ * Otherwise, the engine logger will be used.
+ *
+ */
+
+ /* Create the manager. autoConfigure and includeDefaults are both
booleans which default to true. */
+ ToolManager manager = new ToolManager(autoConfigure, includeDefaults);
+
++ Initialization using a provided configuration file (to customize tools or
tune standard tools configuration):
+
+ /* Create tools initialization properties */
+ Map<String, Object> properties = new HashMap<String, Object>();
+ /* RenderTool needs to know the VelocityEngine. Setting the engine
will also set the logger. */
+ properties.put("engine", engine);
+ /* If the render tool is not to be used, you can instead just set the
logger if needed as follow:
+ *
+ * properties.put("log", logger);
+ *
+ * Otherwise, the engine logger will be used.
+ *
+ */
+
+ /* Create the manager. includeDefaults is a boolean which defaults to
true. */
+ ToolManager manager = new ToolManager(false, includeDefaults);
+
+ /* Configure the manager
+ * toolsConfiguration is a filesystem- or class- path towards your
tools configuration,
+ * which can be a .xml, a .properties, or a .class of a configuration
factory which
+ * has a getConfiguration() method returning a FactoryConfiguration
object.");
+ */
+ manager.configure(toolsConfiguration);
+
+You can then create Velocity contexts with:
+
+ Context context = manager.createContext();
+
+
## Default Configuration
-The default configuration provided for GenericTools is
[here](http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/tools.xml?view=markup.
It includes all of the tools listed [below](#tools).
+The default configuration provided for GenericTools is
[here](http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/src/main/resources/org/apache/velocity/tools/generic/tools.xml?view=markup).
It includes all of the tools listed [below](#tools).
## Dependencies
Modified: velocity/site/cms/trunk/content/tools/devel/struts.mdtext
URL:
http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/tools/devel/struts.mdtext?rev=1768688&r1=1768687&r2=1768688&view=diff
==============================================================================
--- velocity/site/cms/trunk/content/tools/devel/struts.mdtext (original)
+++ velocity/site/cms/trunk/content/tools/devel/struts.mdtext Tue Nov 8
13:30:56 2016
@@ -20,7 +20,7 @@ We're convinced that once you give Veloc
VelocityStruts includes both the [GenericTools](generic.html) and
[VelocityView](view.html) and adds tools for use in Struts 1.x applications.
These tools match the functions of the key Struts taglibs and provide access to
Struts resources, messages, tiles, validation functions and more.
-The default configuration provided for [VelocityStruts](struts.html) is
[here](http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/tools.xml?view=markup),
[here](http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/tools.xml?view=markup)
and
[here](http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/struts/tools.xml?view=markup).
+The default configuration provided for [VelocityStruts](struts.html) is
[here](http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-struts/src/main/resources/org/apache/velocity/tools/generic/tools.xml?view=markup),
[here](http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-view/src/main/resources/org/apache/velocity/tools/view/tools.xml?view=markup)
and
[here](http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-struts/src/main/resources/org/apache/velocity/tools/struts/tools.xml?view=markup).
## Dependencies
Modified: velocity/site/cms/trunk/content/tools/devel/view.mdtext
URL:
http://svn.apache.org/viewvc/velocity/site/cms/trunk/content/tools/devel/view.mdtext?rev=1768688&r1=1768687&r2=1768688&view=diff
==============================================================================
--- velocity/site/cms/trunk/content/tools/devel/view.mdtext (original)
+++ velocity/site/cms/trunk/content/tools/devel/view.mdtext Tue Nov 8 13:30:56
2016
@@ -14,7 +14,7 @@ Key features:
## Default Configuration
-The default configuration provided for VelocityView is
[here](http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/generic/tools.xml?view=markup")
and
[here](http://svn.apache.org/viewvc/velocity/tools/trunk/src/main/java/org/apache/velocity/tools/view/tools.xml).
+The default configuration provided for VelocityView is
[here](http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-generic/src/main/resources/org/apache/velocity/tools/generic/tools.xml?view=markup")
and
[here](http://svn.apache.org/viewvc/velocity/tools/trunk/velocity-tools-view/src/main/resources/org/apache/velocity/tools/view/tools.xml?view=markup).
## Dependencies