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><!-- Define Velocity template compiler -->
-<servlet>
- <servlet-name>velocity</servlet-name>
- <servlet-class>
- org.apache.velocity.tools.view.servlet.VelocityViewServlet
- </servlet-class>
-
- <init-param>
- <param-name>org.apache.velocity.toolbox</param-name>
- <param-value>/WEB-INF/toolbox.xml</param-value>
- </init-param>
-
- <init-param>
- <param-name>org.apache.velocity.properties</param-name>
- <param-value>/WEB-INF/velocity.properties</param-value>
- </init-param>
-
- <load-on-startup>10</load-on-startup>
-</servlet>
-
-<!-- Map *.vm files to Velocity -->
-<servlet-mapping>
- <servlet-name>velocity</servlet-name>
- <url-pattern>*.vm</url-pattern>
-</servlet-mapping></sourcecode></pre>
+ <pre><sourcecode><!-- Define Velocity template compiler -->
+;<servlet>
+; <servlet-name>velocity</servlet-name>
+; <servlet-class>
+; org.apache.velocity.tools.view.servlet.VelocityViewServlet
+ </servlet-class>
+
+; <init-param>
+; <param-name>org.apache.velocity.toolbox</param-name>
+; <param-value>/WEB-INF/toolbox.xml</param-value>
+; </init-param>
+
+; <init-param>
+; <param-name>org.apache.velocity.properties</param-name>
+; <param-value>/WEB-INF/velocity.properties</param-value>
+; </init-param>
+
+; <load-on-startup>10</load-on-startup>
+;</servlet>
+
+;<!-- Map *.vm files to Velocity -->
+;<servlet-mapping>
+; <servlet-name>velocity</servlet-name>
+; <url-pattern>*.vm</url-pattern>
+;</servlet-mapping></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><?xml version="1.0"?>
-<toolbox>
- <tool>
- <key>wrench</key>
- <scope>application</scope>
- <class>PipeWrench</class>
- </tool>
-</toolbox></sourcecode></pre>
+ <pre><sourcecode><?xml version="1.0"?>
+;<toolbox>
+; <tool>
+; <key>wrench</key>
+; <scope>application</scope>
+; <class>PipeWrench</class>
+; </tool>
+;</toolbox></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 <scope>
- element to your toolbox.xml entries like this:</p>
+<p>You can specify the scope of your tools by adding a <scope>
+; 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><tool>
- <key>math</key>
- <scope>application</scope>
- <class>org.apache.velocity.tools.generic.MathTool</class>
-</tool></sourcecode></pre>
+ <pre><sourcecode><tool>
+; <key>math</key>
+; <scope>application</scope>
+; <class>org.apache.velocity.tools.generic.MathTool</class>
+;</tool></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 <request-path> 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><tool>
+; <key>catalog</key>
+; <scope>request</scope>
+; <request-path>/catalog/*</request-path>
+; <class>com.mycompany.tools.CatalogTool</class>
+;</tool></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 <parameter>
- element to your toolbox.xml entries like this:</p>
+<p>You can specify parameters for your tools by adding a <parameter>
+; 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><tool>
- <key>math</key>
- <scope>application</scope>
- <class>com.foo.tools.MyTool</class>
- <parameter name="my.parameter.name" value="my.parameter.value"/>
-</tool></sourcecode></pre>
+ <pre><sourcecode><tool>
+; <key>math</key>
+; <scope>application</scope>
+; <class>com.foo.tools.MyTool</class>
+; <parameter name="my.parameter.name" value="my.parameter.value"/>
+;</tool></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><?xml version="1.0"?>
-<toolbox>
- <data type="number">
- <key>app_version</key>
- <value>0.9</value>
- </data>
- <data type="string">
- <key>app_name</key>
- <value>Jon's Tool Shop</value>
- </data>
- <data type="boolean">
- <key>debug</key>
- <value>true</value>
- </data>
-</toolbox></sourcecode></pre>
+ <pre><sourcecode><?xml version="1.0"?>
+;<toolbox>
+; <data type="number">
+; <key>app_version</key>
+; <value>0.9</value>
+; </data>
+; <data type="string">
+; <key>app_name</key>
+; <value>Jon's Tool Shop</value>
+; </data>
+; <data type="boolean">
+; <key>debug</key>
+; <value>true</value>
+; </data>
+;</toolbox></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 <request-path> 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><tool>
+ <key>catalog</key>
+ <scope>request</scope>
+ <request-path>/catalog/*</request-path>
+ <class>com.mycompany.tools.CatalogTool</class>
+</tool></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]