click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject svn commit: r797943 - in /incubator/click/trunk/click/documentation: docs/faq.html xdocs/src/docbook/click/chapter-pages.xml
Date Sun, 26 Jul 2009 14:59:19 GMT
Author: sabob
Date: Sun Jul 26 14:59:19 2009
New Revision: 797943

added docs describing how to implement custom extensions


Modified: incubator/click/trunk/click/documentation/docs/faq.html
--- incubator/click/trunk/click/documentation/docs/faq.html (original)
+++ incubator/click/trunk/click/documentation/docs/faq.html Sun Jul 26 14:59:19 2009
@@ -507,10 +507,15 @@
       <b>14.&nbsp; Can Click be mapped to an extension other than *.htm?</b>
-  Currently Click only supports *.htm extension. You cannot create templates
-  with a different extension for example '.xml'.
+  By default Click supports *.htm and *.jsp extensions.
-  However you can map URLs to different extensions using
+  However you can map templates with different extensions, for example *.xml, by
+  subclassing <tt>XmlConfigService</tt> and specify extra mappings by overriding
+  <tt>isTemplate(String path)</tt>. You can read more details
+  <a href="click-api/org/apache/click/service/XmlConfigService.html#isTemplate(java.lang.String)">here</a>.
+  <p/>
+  You can also map URLs to different extensions using
   <a href="">Url Rewrite Filter</a>. It is even
   possible to rewrite to REST like URLs:
@@ -551,7 +556,7 @@
    Spring uses a <tt>DispatcherServlet</tt> to route requests to <tt>Controller</tt>

    objects and then passes the <tt>ModelAndView</tt> results to the rendering
-<pre class="codeJava">
+<pre class="prettyprint">
 public interface Controller {
    public ModelAndView handleRequest(HttpServletRequest request, 
                                      HttpServletResponse response) throws Exception;
@@ -571,11 +576,13 @@
    Click fully supports JSP pages. 
-   JSP Pages can be automatically loaded, like Velocity templates, and 
+   JSP Pages can be automatically loaded, like Velocity templates, or
    can be explicitly defined in the <tt>click.xml</tt> file.
  <pre class="codeConfig">
-&lt;page path="<span class="blue">customers-table.jsp</span>" class="<span
class="red">com.mycorp.pages.CustomersTable</span>"/&gt; </pre>
+&lt;pages package="com.mycorp.pages"/&gt;
+  &lt;page path="<span class="blue">customers-table.jsp</span>" class="<span
+&lt;/pages&gt; </pre>
    The page's model data values are automatically added to the request as
    attributes so they are available in the JSP. Other Click values added 

Modified: incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-pages.xml
--- incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-pages.xml (original)
+++ incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-pages.xml Sun
Jul 26 14:59:19 2009
@@ -38,14 +38,21 @@
   the Freemarker template engine instead of Velocity, the setup is the same.
-  <para>The template path must have an <varname>.htm</varname> extension
+  <para>The template path should have an <varname>.htm</varname> extension
   is specified in <link linkend="servlet-configuration">web.xml</link> to route
-  *.htm requests to the <classname>ClickServlet</classname>. Please note that
-  currently Click only accepts <varname>.htm</varname> requests, and cannot be
-  mapped to a different extension in <filename>web.xml</filename>.
+  *.htm requests to the <classname>ClickServlet</classname>.
-  <para>If you use JSP pages for rendering the <varname>.jsp</varname>
+  <para>Please note if you want Click to process templates with a different
+  extension e.g. <varname>.xml</varname>, you need to implement the method
+  <ulink url="../../click-api/org/apache/click/service/ConfigService.html#isTemplate(java.lang.String)">isTemplate(String
+  and specify the extra extensions. The simplest way is to subclass
+  <classname>XmlConfigService</classname> and override the default implementation
+  as described <ulink url="../../click-api/org/apache/click/service/XmlConfigService.html#isTemplate(java.lang.String)">here</ulink>.
+  Also remember to map the new extensions in <filename>web.xml</filename>.
+  </para>
+  <para>If you use JSP pages for rendering, the <varname>.jsp</varname>
   must be used. For example:

View raw message