Author: nbubna
Date: Tue Nov 14 14:08:52 2006
New Revision: 475017

URL: http://svn.apache.org/viewvc?view=rev&rev=475017
Log:
add documentation for request-path filter (VELTOOLS-67), thanks to Claude 
Brisson for the bulk of the content

Modified:
    jakarta/velocity/tools/trunk/docs/view/index.html
    jakarta/velocity/tools/trunk/xdocs/view/index.xml

Modified: jakarta/velocity/tools/trunk/docs/view/index.html
URL: 
http://svn.apache.org/viewvc/jakarta/velocity/tools/trunk/docs/view/index.html?view=diff&rev=475017&r1=475016&r2=475017
==============================================================================
--- jakarta/velocity/tools/trunk/docs/view/index.html (original)
+++ jakarta/velocity/tools/trunk/docs/view/index.html Tue Nov 14 14:08:52 2006
@@ -175,31 +175,31 @@
 <p><b>web.xml</b></p>
 <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td 
bgcolor="#000000">
   <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td 
bgcolor="#FFFFFF">
-    <pre><sourcecode>&lt;!-- Define Velocity template compiler --&gt;
-&lt;servlet&gt;
-  &lt;servlet-name&gt;velocity&lt;/servlet-name&gt;
-  &lt;servlet-class&gt;
-    org.apache.velocity.tools.view.servlet.VelocityViewServlet
-  &lt;/servlet-class&gt;
-
-  &lt;init-param&gt;
-    &lt;param-name&gt;org.apache.velocity.toolbox&lt;/param-name&gt;
-    &lt;param-value&gt;/WEB-INF/toolbox.xml&lt;/param-value&gt;
- &lt;/init-param&gt;
-
-  &lt;init-param&gt;
-    &lt;param-name&gt;org.apache.velocity.properties&lt;/param-name&gt;
-    &lt;param-value&gt;/WEB-INF/velocity.properties&lt;/param-value&gt;
- &lt;/init-param&gt;
-
- &lt;load-on-startup&gt;10&lt;/load-on-startup&gt;
-&lt;/servlet&gt;
-
-&lt;!-- Map *.vm files to Velocity --&gt;
-&lt;servlet-mapping&gt;
-  &lt;servlet-name&gt;velocity&lt;/servlet-name&gt;
-  &lt;url-pattern&gt;*.vm&lt;/url-pattern&gt;
-&lt;/servlet-mapping&gt;</sourcecode></pre>
+    <pre><sourcecode>&lt;!-- Define Velocity template compiler --&gt
+;&lt;servlet&gt
+;  &lt;servlet-name&gt;velocity&lt;/servlet-name&gt
+;  &lt;servlet-class&gt
+;    org.apache.velocity.tools.view.servlet.VelocityViewServlet
+  &lt;/servlet-class&gt
+
+;  &lt;init-param&gt
+;    &lt;param-name&gt;org.apache.velocity.toolbox&lt;/param-name&gt
+;    &lt;param-value&gt;/WEB-INF/toolbox.xml&lt;/param-value&gt
+; &lt;/init-param&gt
+
+;  &lt;init-param&gt
+;    &lt;param-name&gt;org.apache.velocity.properties&lt;/param-name&gt
+;    &lt;param-value&gt;/WEB-INF/velocity.properties&lt;/param-value&gt
+; &lt;/init-param&gt
+
+; &lt;load-on-startup&gt;10&lt;/load-on-startup&gt
+;&lt;/servlet&gt
+
+;&lt;!-- Map *.vm files to Velocity --&gt
+;&lt;servlet-mapping&gt
+;  &lt;servlet-name&gt;velocity&lt;/servlet-name&gt
+;  &lt;url-pattern&gt;*.vm&lt;/url-pattern&gt
+;&lt;/servlet-mapping&gt;</sourcecode></pre>
   </td></tr></table>
 </td></tr></table>
 
@@ -273,22 +273,22 @@
   <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td 
bgcolor="#FFFFFF">
     <pre><sourcecode>public class PipeWrench {
   public String getSize() {
-       return "Large Pipe Wrench!";
-  }
+       return "Large Pipe Wrench!"
+;  }
 } </sourcecode></pre>
   </td></tr></table>
 </td></tr></table>
 <p><b>toolbox.xml</b></p>
 <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td 
bgcolor="#000000">
   <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td 
bgcolor="#FFFFFF">
-    <pre><sourcecode>&lt;?xml version="1.0"?&gt;
-&lt;toolbox&gt;
-  &lt;tool&gt;
-     &lt;key&gt;wrench&lt;/key&gt;
-     &lt;scope&gt;application&lt;/scope&gt;
-     &lt;class&gt;PipeWrench&lt;/class&gt;
-  &lt;/tool&gt;
-&lt;/toolbox&gt;</sourcecode></pre>
+    <pre><sourcecode>&lt;?xml version="1.0"?&gt
+;&lt;toolbox&gt
+;  &lt;tool&gt
+;     &lt;key&gt;wrench&lt;/key&gt
+;     &lt;scope&gt;application&lt;/scope&gt
+;     &lt;class&gt;PipeWrench&lt;/class&gt
+;  &lt;/tool&gt
+;&lt;/toolbox&gt;</sourcecode></pre>
   </td></tr></table>
 </td></tr></table>
 <br clear="all"/>
@@ -325,18 +325,39 @@
         implements ViewTool, then its <code>init(Object)</code> method will be
         passed the current ViewContext.</li>
       </ul>
-<p>You can specify the scope of your tools by adding a &lt;scope&gt;
-      element to your toolbox.xml entries like this:</p>
+<p>You can specify the scope of your tools by adding a &lt;scope&gt
+;      element to your toolbox.xml entries like this:</p>
 <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td 
bgcolor="#000000">
   <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td 
bgcolor="#FFFFFF">
-    <pre><sourcecode>&lt;tool&gt;
-   &lt;key&gt;math&lt;/key&gt;
-   &lt;scope&gt;application&lt;/scope&gt;
-   &lt;class&gt;org.apache.velocity.tools.generic.MathTool&lt;/class&gt;
-&lt;/tool&gt;</sourcecode></pre>
+    <pre><sourcecode>&lt;tool&gt
+;   &lt;key&gt;math&lt;/key&gt
+;   &lt;scope&gt;application&lt;/scope&gt
+;   &lt;class&gt;org.apache.velocity.tools.generic.MathTool&lt;/class&gt
+;&lt;/tool&gt;</sourcecode></pre>
   </td></tr></table>
 </td></tr></table>
 <br clear="all"/>
+<p><b>Tool Request Paths</b></p>
+<p>You can specify a restriction on the request URIs for which the tool
+      will be put in the context using the &lt;request-path&gt; element.
+      It can be an exact request path (matching one page) or end with the 
+      <code>*</code> wildard, meaning that incoming request paths need only
+      start with the provided value for the tool to be available in the 
context.
+      For instance:</p>
+<table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td 
bgcolor="#000000">
+  <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td 
bgcolor="#FFFFFF">
+    <pre><sourcecode>&lt;tool&gt
+;   &lt;key&gt;catalog&lt;/key&gt
+;   &lt;scope&gt;request&lt;/scope&gt
+;   &lt;request-path&gt;/catalog/*&lt;/request-path&gt
+;   &lt;class&gt;com.mycompany.tools.CatalogTool&lt;/class&gt
+;&lt;/tool&gt;</sourcecode></pre>
+  </td></tr></table>
+</td></tr></table>
+<p>For now, this request-path filter is only valid for request scoped tools.
+      In VelocityTools 2.0, we plan to support this for session and application
+      scoped tools as well.</p>
+<br clear="all"/>
 <p><b>Tool Parameters</b></p>
 <p>The toolbox support built into the VelocityViewServlet also provides
       support for passing configuration parameters to tools that implement
@@ -344,16 +365,16 @@
       interface. This interface consists of only a 
       <code>void configure(java.util.Map params)</code> method which will only 
be called
       if parameters have been specified for the tool.</p>
-<p>You can specify parameters for your tools by adding a &lt;parameter&gt;
-      element to your toolbox.xml entries like this:</p>
+<p>You can specify parameters for your tools by adding a &lt;parameter&gt
+;      element to your toolbox.xml entries like this:</p>
 <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td 
bgcolor="#000000">
   <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td 
bgcolor="#FFFFFF">
-    <pre><sourcecode>&lt;tool&gt;
-   &lt;key&gt;math&lt;/key&gt;
-   &lt;scope&gt;application&lt;/scope&gt;
-   &lt;class&gt;com.foo.tools.MyTool&lt;/class&gt;
-   &lt;parameter name="my.parameter.name" value="my.parameter.value"/&gt;
-&lt;/tool&gt;</sourcecode></pre>
+    <pre><sourcecode>&lt;tool&gt
+;   &lt;key&gt;math&lt;/key&gt
+;   &lt;scope&gt;application&lt;/scope&gt
+;   &lt;class&gt;com.foo.tools.MyTool&lt;/class&gt
+;   &lt;parameter name="my.parameter.name" value="my.parameter.value"/&gt
+;&lt;/tool&gt;</sourcecode></pre>
   </td></tr></table>
 </td></tr></table>
 <br clear="all"/>
@@ -365,21 +386,21 @@
       is as follows:</p>
 <table width="100%" cellpadding="1" cellspacing="0" border="0"><tr><td 
bgcolor="#000000">
   <table width="100%" cellpadding="5" cellspacing="0" border="0"><tr><td 
bgcolor="#FFFFFF">
-    <pre><sourcecode>&lt;?xml version="1.0"?&gt;
-&lt;toolbox&gt;
-  &lt;data type="number"&gt;
-     &lt;key&gt;app_version&lt;/key&gt;
-     &lt;value&gt;0.9&lt;/value&gt;
-  &lt;/data&gt;
-  &lt;data type="string"&gt;
-     &lt;key&gt;app_name&lt;/key&gt;
-     &lt;value&gt;Jon's Tool Shop&lt;/value&gt;
-  &lt;/data&gt;
-  &lt;data type="boolean"&gt;
-     &lt;key&gt;debug&lt;/key&gt;
-     &lt;value&gt;true&lt;/value&gt;
-  &lt;/data&gt;
-&lt;/toolbox&gt;</sourcecode></pre>
+    <pre><sourcecode>&lt;?xml version="1.0"?&gt
+;&lt;toolbox&gt
+;  &lt;data type="number"&gt
+;     &lt;key&gt;app_version&lt;/key&gt
+;     &lt;value&gt;0.9&lt;/value&gt
+;  &lt;/data&gt
+;  &lt;data type="string"&gt
+;     &lt;key&gt;app_name&lt;/key&gt
+;     &lt;value&gt;Jon's Tool Shop&lt;/value&gt
+;  &lt;/data&gt
+;  &lt;data type="boolean"&gt
+;     &lt;key&gt;debug&lt;/key&gt
+;     &lt;value&gt;true&lt;/value&gt
+;  &lt;/data&gt
+;&lt;/toolbox&gt;</sourcecode></pre>
   </td></tr></table>
 </td></tr></table>
 <p>As with your tools, your data will be exposed to your templates

Modified: jakarta/velocity/tools/trunk/xdocs/view/index.xml
URL: 
http://svn.apache.org/viewvc/jakarta/velocity/tools/trunk/xdocs/view/index.xml?view=diff&rev=475017&r1=475016&r2=475017
==============================================================================
--- jakarta/velocity/tools/trunk/xdocs/view/index.xml (original)
+++ jakarta/velocity/tools/trunk/xdocs/view/index.xml Tue Nov 14 14:08:52 2006
@@ -216,6 +216,28 @@
 
       <br clear="all"/>
 
+      <p><b>Tool Request Paths</b></p>
+      
+      <p>You can specify a restriction on the request URIs for which the tool
+      will be put in the context using the &lt;request-path&gt; element.
+      It can be an exact request path (matching one page) or end with the 
+      <code>*</code> wildard, meaning that incoming request paths need only
+      start with the provided value for the tool to be available in the 
context.
+      For instance:</p>
+
+      <sourcecode>&lt;tool&gt;
+   &lt;key&gt;catalog&lt;/key&gt;
+   &lt;scope&gt;request&lt;/scope&gt;
+   &lt;request-path&gt;/catalog/*&lt;/request-path&gt;
+   &lt;class&gt;com.mycompany.tools.CatalogTool&lt;/class&gt;
+&lt;/tool&gt;</sourcecode>
+
+      <p>For now, this request-path filter is only valid for request scoped 
tools.
+      In VelocityTools 2.0, we plan to support this for session and application
+      scoped tools as well.</p>
+
+      <br clear="all"/>
+
       <p><b>Tool Parameters</b></p>
 
       <p>The toolbox support built into the VelocityViewServlet also provides



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to