You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by cb...@apache.org on 2016/09/13 13:55:59 UTC

svn commit: r1760548 [2/4] - in /velocity/site/production: ./ anakia/ docbook/ dvsl/ engine/ engine/1.7/ engine/devel/ texen/ tools/ tools/2.0/ tools/devel/

Modified: velocity/site/production/engine/1.7/source-repository.html
URL: http://svn.apache.org/viewvc/velocity/site/production/engine/1.7/source-repository.html?rev=1760548&r1=1760547&r2=1760548&view=diff
==============================================================================
--- velocity/site/production/engine/1.7/source-repository.html (original)
+++ velocity/site/production/engine/1.7/source-repository.html Tue Sep 13 13:55:58 2016
@@ -226,27 +226,28 @@ h2:hover > .headerlink, h3:hover > .head
 <p>This project uses <a href="http://subversion.tigris.org">Subversion</a> to manage its source code. Instructions on Subversion use can be found at <a href="http://svnbook.red-bean.com/">http://svnbook.red-bean.com/</a>.</p>
 <h2 id="web-access">Web Access<a class="headerlink" href="#web-access" title="Permanent link">&para;</a></h2>
 <p>The following is a link to the online source repository.</p>
-<p class="frame"><a href="http://svn.apache.org/viewvc/velocity/engine/trunk">http://svn.apache.org/viewvc/velocity/engine/trunk</a></p>
+<p class="frame"><a href="http://svn.apache.org/viewvc/velocity/engine/trunk">http://svn.apache.org/viewvc/velocity/engine/trunk</a>
+</p>
 <h2 id="anonymous-access">Anonymous access<a class="headerlink" href="#anonymous-access" title="Permanent link">&para;</a></h2>
 <p>The source can be checked out anonymously from SVN with this command:</p>
-<div class="codehilite"><pre><span class="nv">$ </span>svn checkout http://svn.apache.org/repos/asf/velocity/engine/trunk velocity
+<div class="codehilite"><pre>$ svn checkout http://svn.apache.org/repos/asf/velocity/engine/trunk velocity
 </pre></div>
 
 
 <h2 id="developer-access">Developer access<a class="headerlink" href="#developer-access" title="Permanent link">&para;</a></h2>
 <p>Everyone can access the Subversion repository via HTTP, but Committers must checkout the Subversion repository via HTTPS.</p>
-<div class="codehilite"><pre><span class="nv">$ </span>svn checkout https://svn.apache.org/repos/asf/velocity/engine/trunk velocity
+<div class="codehilite"><pre>$ svn checkout https://svn.apache.org/repos/asf/velocity/engine/trunk velocity
 </pre></div>
 
 
 <p>To commit changes to the repository, execute the following command to commit your changes (svn will prompt you for your password)</p>
-<div class="codehilite"><pre><span class="nv">$ </span>svn commit --username your-username -m <span class="s2">&quot;A message&quot;</span>
+<div class="codehilite"><pre>$ svn commit --username your-username -m <span class="s2">&quot;A message&quot;</span>
 </pre></div>
 
 
 <h2 id="access-from-behind-a-firewall">Access from behind a firewall<a class="headerlink" href="#access-from-behind-a-firewall" title="Permanent link">&para;</a></h2>
 <p>For those users who are stuck behind a corporate firewall which is blocking HTTP access to the Subversion repository, you can try to access it via the developer connection:</p>
-<div class="codehilite"><pre><span class="nv">$ </span>svn checkout https://svn.apache.org/repos/asf/velocity/engine/trunk velocity
+<div class="codehilite"><pre>$ svn checkout https://svn.apache.org/repos/asf/velocity/engine/trunk velocity
 </pre></div>
 
 

Modified: velocity/site/production/engine/devel/configuration.html
URL: http://svn.apache.org/viewvc/velocity/site/production/engine/devel/configuration.html?rev=1760548&r1=1760547&r2=1760548&view=diff
==============================================================================
--- velocity/site/production/engine/devel/configuration.html (original)
+++ velocity/site/production/engine/devel/configuration.html Tue Sep 13 13:55:58 2016
@@ -326,6 +326,10 @@ h2:hover > .headerlink, h3:hover > .head
 <p>Used to turn on the automatic provision of the $template scope control during #parse calls and template.merge(...) calls. The default is false. Set it to true if you want a secure namespace for your template variables or more advanced #break control.</p>
 </blockquote>
 <h2 id="resource-management">Resource Management<a class="headerlink" href="#resource-management" title="Permanent link">&para;</a></h2>
+<p>**<code>resource.manager.instance = null</code></p>
+<blockquote>
+<p>Living Java instance, that must implement the interface org.apache.velocity.runtime.resource.ResourceManager. This property can only be set programmatically, and takes precedence over the next property. It is otherwise used by Velocity to store its actual resource manager once instanciated.</p>
+</blockquote>
 <p><strong><code>resource.manager.class = org.apache.velocity.runtime.resource.ResourceManagerImpl</code></strong></p>
 <blockquote>
 <p>Replace the Velocity default Resource Manager class. A resource manager implementation must implement the (<code>org.apache.velocity.runtime.resource.ResourceManager</code>)[apidocs/org/apache/velocity/runtime/resource/ResourceManager.html] interface. A description of the requirements of a resource manager is out of scope for this document. Implementors are encouraged to review the default implementation.</p>
@@ -341,11 +345,12 @@ h2:hover > .headerlink, h3:hover > .head
 </blockquote>
 <p><strong><code>resource.manager.defaultcache.size = 89</code></strong></p>
 <blockquote>
-<p>Sets the size of the default implementation of the resource manager cache size. When <code>resource.manager.defaultcache.size</code> is set to 0, then the default implementation uses the standard Java <code>ConcurrentHashMap</code>. Otherwise, a non-zero cache size uses an LRU Map. The default cache size is 89. Note that the ConcurrentHashMap may be better at thread concurrency.</p>
+<p>Sets the size of the default implementation of the resource manager cache size (in number of elements). When <code>resource.manager.defaultcache.size</code> is set to 0, then the default implementation uses the standard Java <code>ConcurrentHashMap</code>. Otherwise, a non-zero cache size uses an LRU Map. The default cache size is 89. Note that the ConcurrentHashMap may be better at thread concurrency.</p>
 </blockquote>
 <p><strong><code>resource.loader = file</code></strong></p>
 <blockquote>
 <p><em>Multi-valued key.  Will accept CSV for value.</em>  Public name of a resource loader to be used.  This public name will then be used in the specification of the specific properties for that resource loader. Note that as a multi-valued key, it's possible to pass a value like "file, string" (sans quotes), indicating that following will be configuration values for two loaders.</p>
+<p>Please note than <a href="tools/devel">VelocityTools</a> will override the default value and set it to <code>webapp</code>.</p>
 </blockquote>
 <p><strong> <em>name</em><code>.loader.description = Velocity File Resource Loader</code></strong></p>
 <blockquote>
@@ -353,7 +358,7 @@ h2:hover > .headerlink, h3:hover > .head
 </blockquote>
 <p><strong> <em>name</em><code>.resource.loader.class = org.apache.velocity.runtime.resource.loader.FileResourceLoader</code></strong></p>
 <blockquote>
-<p>Name of implementation class for the loader.  The default loader is the file loader.</p>
+<p>Name of implementation class for the loader. The default loader is the <a href="/engine/devel/apidocs/org/apache/velocity/runtime/resource/loader/FileResourceLoader.html">file resource loader</a> (or the <a href="/tools/devel/apidocs/org/apache/velocity/tools/view/WebappResourceLoader.html">webapp resource loader</a> for VelocityTools).</p>
 </blockquote>
 <p><strong> <em>name</em><code>.resource.loader.path = .</code></strong></p>
 <blockquote>

Modified: velocity/site/production/engine/devel/developer-guide.html
URL: http://svn.apache.org/viewvc/velocity/site/production/engine/devel/developer-guide.html?rev=1760548&r1=1760547&r2=1760548&view=diff
==============================================================================
--- velocity/site/production/engine/devel/developer-guide.html (original)
+++ velocity/site/production/engine/devel/developer-guide.html Tue Sep 13 13:55:58 2016
@@ -361,17 +361,17 @@ h2:hover > .headerlink, h3:hover > .head
 
 <span class="n">VelocityContext</span> <span class="n">context</span> <span class="o">=</span> <span class="n">new</span> <span class="n">VelocityContext</span><span class="p">();</span>
 
-<span class="n">context</span><span class="o">.</span><span class="n">put</span><span class="p">(</span> <span class="s">&quot;name&quot;</span><span class="p">,</span> <span class="n">new</span> <span class="n">String</span><span class="p">(</span><span class="s">&quot;Velocity&quot;</span><span class="p">)</span> <span class="p">);</span>
+<span class="n">context</span><span class="o">.</span><span class="n">put</span><span class="p">(</span> <span class="s2">&quot;name&quot;</span><span class="p">,</span> <span class="n">new</span> <span class="n">String</span><span class="p">(</span><span class="s2">&quot;Velocity&quot;</span><span class="p">)</span> <span class="p">);</span>
 
 <span class="n">Template</span> <span class="n">template</span> <span class="o">=</span> <span class="n">null</span><span class="p">;</span>
 
 <span class="k">try</span>
 <span class="p">{</span>
-  <span class="n">template</span> <span class="o">=</span> <span class="n">Velocity</span><span class="o">.</span><span class="n">getTemplate</span><span class="p">(</span><span class="s">&quot;mytemplate.vm&quot;</span><span class="p">);</span>
+  <span class="n">template</span> <span class="o">=</span> <span class="n">Velocity</span><span class="o">.</span><span class="n">getTemplate</span><span class="p">(</span><span class="s2">&quot;mytemplate.vm&quot;</span><span class="p">);</span>
 <span class="p">}</span>
 <span class="n">catch</span><span class="p">(</span> <span class="n">ResourceNotFoundException</span> <span class="n">rnfe</span> <span class="p">)</span>
 <span class="p">{</span>
-  <span class="o">//</span> <span class="n">couldn</span><span class="s">&#39;t find the template</span>
+  <span class="o">//</span> <span class="n">couldn</span><span class="s1">&#39;t find the template</span>
 <span class="p">}</span>
 <span class="n">catch</span><span class="p">(</span> <span class="n">ParseErrorException</span> <span class="n">pee</span> <span class="p">)</span>
 <span class="p">{</span>
@@ -406,7 +406,7 @@ h2:hover > .headerlink, h3:hover > .head
  <span class="o">*/</span>
 
 <span class="n">Velocity</span><span class="o">.</span><span class="n">setProperty</span><span class="p">(</span>
-    <span class="n">Velocity</span><span class="o">.</span><span class="n">RUNTIME_LOG_NAME</span><span class="p">,</span> <span class="s">&quot;mylog&quot;</span><span class="p">);</span>
+    <span class="n">Velocity</span><span class="o">.</span><span class="n">RUNTIME_LOG_NAME</span><span class="p">,</span> <span class="s2">&quot;mylog&quot;</span><span class="p">);</span>
 
 <span class="o">/*</span>
  <span class="o">*</span>  <span class="n">now</span> <span class="n">initialize</span> <span class="n">the</span> <span class="n">engine</span>
@@ -416,7 +416,7 @@ h2:hover > .headerlink, h3:hover > .head
 
 <span class="o">...</span>
 
-<span class="n">Template</span> <span class="n">t</span> <span class="o">=</span> <span class="n">Velocity</span><span class="o">.</span><span class="n">getTemplate</span><span class="p">(</span><span class="s">&quot;foo.vm&quot;</span><span class="p">);</span>
+<span class="n">Template</span> <span class="n">t</span> <span class="o">=</span> <span class="n">Velocity</span><span class="o">.</span><span class="n">getTemplate</span><span class="p">(</span><span class="s2">&quot;foo.vm&quot;</span><span class="p">);</span>
 </pre></div>
 
 
@@ -439,7 +439,7 @@ h2:hover > .headerlink, h3:hover > .head
  <span class="o">*/</span>
 
 <span class="n">ve</span><span class="o">.</span><span class="n">setProperty</span><span class="p">(</span>
-    <span class="n">VelocityEngine</span><span class="o">.</span><span class="n">RUNTIME_LOG_NAME</span><span class="p">,</span> <span class="s">&quot;mylog&quot;</span><span class="p">);</span>
+    <span class="n">VelocityEngine</span><span class="o">.</span><span class="n">RUNTIME_LOG_NAME</span><span class="p">,</span> <span class="s2">&quot;mylog&quot;</span><span class="p">);</span>
 
 <span class="o">/*</span>
  <span class="o">*</span>  <span class="n">initialize</span> <span class="n">the</span> <span class="n">engine</span>
@@ -449,7 +449,7 @@ h2:hover > .headerlink, h3:hover > .head
 
 <span class="o">...</span>
 
-<span class="n">Template</span> <span class="n">t</span> <span class="o">=</span> <span class="n">ve</span><span class="o">.</span><span class="n">getTemplate</span><span class="p">(</span><span class="s">&quot;foo.vm&quot;</span><span class="p">);</span>
+<span class="n">Template</span> <span class="n">t</span> <span class="o">=</span> <span class="n">ve</span><span class="o">.</span><span class="n">getTemplate</span><span class="p">(</span><span class="s2">&quot;foo.vm&quot;</span><span class="p">);</span>
 </pre></div>
 
 
@@ -635,22 +635,22 @@ template.merge( context2, writer );
 
         <span class="n">VelocityContext</span> <span class="n">context</span> <span class="o">=</span> <span class="n">new</span> <span class="n">VelocityContext</span><span class="p">();</span>
 
-        <span class="n">context</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="s">&quot;name&quot;</span><span class="p">,</span> <span class="s">&quot;Velocity&quot;</span><span class="p">);</span>
-        <span class="n">context</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="s">&quot;project&quot;</span><span class="p">,</span> <span class="s">&quot;Jakarta&quot;</span><span class="p">);</span>
+        <span class="n">context</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="s2">&quot;name&quot;</span><span class="p">,</span> <span class="s2">&quot;Velocity&quot;</span><span class="p">);</span>
+        <span class="n">context</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="s2">&quot;project&quot;</span><span class="p">,</span> <span class="s2">&quot;Jakarta&quot;</span><span class="p">);</span>
 
         <span class="o">/*</span> <span class="n">lets</span> <span class="n">render</span> <span class="n">a</span> <span class="n">template</span> <span class="o">*/</span>
 
         <span class="n">StringWriter</span> <span class="n">w</span> <span class="o">=</span> <span class="n">new</span> <span class="n">StringWriter</span><span class="p">();</span>
 
-        <span class="n">Velocity</span><span class="o">.</span><span class="n">mergeTemplate</span><span class="p">(</span><span class="s">&quot;testtemplate.vm&quot;</span><span class="p">,</span> <span class="n">context</span><span class="p">,</span> <span class="n">w</span> <span class="p">);</span>
-        <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s">&quot; template : &quot;</span> <span class="o">+</span> <span class="n">w</span> <span class="p">);</span>
+        <span class="n">Velocity</span><span class="o">.</span><span class="n">mergeTemplate</span><span class="p">(</span><span class="s2">&quot;testtemplate.vm&quot;</span><span class="p">,</span> <span class="n">context</span><span class="p">,</span> <span class="n">w</span> <span class="p">);</span>
+        <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s2">&quot; template : &quot;</span> <span class="o">+</span> <span class="n">w</span> <span class="p">);</span>
 
         <span class="o">/*</span> <span class="n">lets</span> <span class="n">make</span> <span class="n">our</span> <span class="n">own</span> <span class="n">string</span> <span class="n">to</span> <span class="n">render</span> <span class="o">*/</span>
 
-        <span class="n">String</span> <span class="n">s</span> <span class="o">=</span> <span class="s">&quot;We are using $project $name to render this.&quot;</span><span class="p">;</span>
+        <span class="n">String</span> <span class="n">s</span> <span class="o">=</span> <span class="s2">&quot;We are using $project $name to render this.&quot;</span><span class="p">;</span>
         <span class="n">w</span> <span class="o">=</span> <span class="n">new</span> <span class="n">StringWriter</span><span class="p">();</span>
-        <span class="n">Velocity</span><span class="o">.</span><span class="n">evaluate</span><span class="p">(</span> <span class="n">context</span><span class="p">,</span> <span class="n">w</span><span class="p">,</span> <span class="s">&quot;mystring&quot;</span><span class="p">,</span> <span class="n">s</span> <span class="p">);</span>
-        <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s">&quot; string : &quot;</span> <span class="o">+</span> <span class="n">w</span> <span class="p">);</span>
+        <span class="n">Velocity</span><span class="o">.</span><span class="n">evaluate</span><span class="p">(</span> <span class="n">context</span><span class="p">,</span> <span class="n">w</span><span class="p">,</span> <span class="s2">&quot;mystring&quot;</span><span class="p">,</span> <span class="n">s</span> <span class="p">);</span>
+        <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s2">&quot; string : &quot;</span> <span class="o">+</span> <span class="n">w</span> <span class="p">);</span>
     <span class="p">}</span>
 <span class="p">}</span>
 </pre></div>
@@ -707,7 +707,7 @@ see the Javadoc API documentation.</p>
     <span class="o">/*</span> <span class="n">first</span><span class="p">,</span> <span class="n">we</span> <span class="n">init</span> <span class="n">the</span> <span class="n">runtime</span> <span class="n">engine</span><span class="o">.</span>  <span class="o">*/</span>
 
     <span class="n">Properties</span> <span class="n">p</span> <span class="o">=</span> <span class="n">new</span> <span class="n">Properties</span><span class="p">();</span>
-    <span class="n">p</span><span class="o">.</span><span class="n">setProperty</span><span class="p">(</span><span class="s">&quot;file.resource.loader.path&quot;</span><span class="p">,</span> <span class="s">&quot;/opt/templates&quot;</span><span class="p">);</span>
+    <span class="n">p</span><span class="o">.</span><span class="n">setProperty</span><span class="p">(</span><span class="s2">&quot;file.resource.loader.path&quot;</span><span class="p">,</span> <span class="s2">&quot;/opt/templates&quot;</span><span class="p">);</span>
     <span class="n">Velocity</span><span class="o">.</span><span class="n">init</span><span class="p">(</span> <span class="n">p</span> <span class="p">);</span>
 
     <span class="o">/*</span> <span class="n">lets</span> <span class="n">make</span> <span class="n">a</span> <span class="n">Context</span> <span class="ow">and</span> <span class="n">put</span> <span class="n">data</span> <span class="n">into</span> <span class="n">it</span> <span class="o">*/</span>
@@ -1015,7 +1015,7 @@ velocityEngine.init();
 <li><code>file.resource.loader.cache</code> = true/false</li>
 <li><code>file.resource.loader.modificationCheckInterval</code> = <seconds between checks></li>
 </ul>
-<p>This is the default loader, and is configured, by default to get templates from the 'current directory'.  In the case of using Velocity with servlets, this can be a problem as you don't want to have to keep your templates in the directory from which you start your servlet engine.  See the documentation for your servlet or web framework (for example <a href="/tools/devel/view-servlet.html">VelocityViewServlet</a>) for more info on how to configure the location of the Velocity templates.</p>
+<p>This is the default loader (except when using VelocityTools, see below), and is configured, by default to get templates from the 'current directory'.  In the case of using Velocity with servlets, this can be a problem as you don't want to have to keep your templates in the directory from which you start your servlet engine.  See the documentation for your servlet or web framework (for example <a href="/tools/devel/view-servlet.html">VelocityViewServlet</a>) for more info on how to configure the location of the Velocity templates.</p>
 </li>
 <li>
 <p><strong>JarResourceLoader :</strong> This loader gets resource from specific jar files.  It is very similar to the FileResourceLoader, except that you have the convenience of bundling your templates into jars.  The properties are identical, except for <code>jar.resource.loader.path</code>, where you provide the full location of the jar(s) you wish to load resources from.  To specify a jar for the loader.path you use the standard JAR URL syntax of <code>java.net.JarURLConnection</code>.</p>
@@ -1036,6 +1036,7 @@ velocityEngine.init();
 <p><strong>DataSourceResourceLoader :</strong>  This loader will load resources from a DataSource such as a database.  This loader is only available under JDK 1.4 and later. For more information on this loader, please see the javadoc for the class <code>org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader</code>.</p>
 </li>
 </ul>
+<p>The <a href="/tools/devel/">VelocityTools</a> project also defines a <a href="/tools/devel/apidocs/org/apache/velocity/tools/view/WebappResourceLoader.html">WebappResourceLoader</a>, active by default, which maps '/' to the root of the webapp.</p>
 <p>Advanced users may also want to replace the Resource Manager or the Resource Cache: the Resource Manager is the main part of the resource (template and static content) management system, and is responsible for taking application requests for templates, finding them in the available resource loaders, and then optionally caching the parsed template. The Resource Cache is the mechanism that the Resource Manager uses to cache templates for quick reuse. While the default versions of these two facilities are suitable for most applications, it is possible to replace the default resource manager and resource cache with custom implementations. See the (related configuration options)[configuration.html#resource-management].</p>
 <h2 id="application-attributes">Application Attributes<a class="headerlink" href="#application-attributes" title="Permanent link">&para;</a></h2>
 <p><em>Application Attributes</em> are name-value pairs that can be associated with a RuntimeInstance (either via the <code>VelocityEngine</code> or the <code>Velocity</code> singleton) and accessed from any part of the Velocity engine that has access to the RuntimeInstance.</p>