click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
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

URL: http://svn.apache.org/viewvc?rev=797943&view=rev
Log:
added docs describing how to implement custom extensions

Modified:
    incubator/click/trunk/click/documentation/docs/faq.html
    incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-pages.xml

Modified: incubator/click/trunk/click/documentation/docs/faq.html
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/documentation/docs/faq.html?rev=797943&r1=797942&r2=797943&view=diff
==============================================================================
--- 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>
   </dt>
   <dd>
-  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.
   <p/>
-  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="http://tuckey.org/urlrewrite/">Url Rewrite Filter</a>. It is even
   possible to rewrite to REST like URLs:
   <ul>
@@ -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
layer.
 
-<pre class="codeJava">
+<pre class="prettyprint">
 public interface Controller {
    public ModelAndView handleRequest(HttpServletRequest request, 
                                      HttpServletResponse response) throws Exception;
@@ -571,11 +576,13 @@
   <dd>
    Click fully supports JSP pages. 
    <p/>
-   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
class="red">CustomersTable</span>"/&gt;
+&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
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/documentation/xdocs/src/docbook/click/chapter-pages.xml?rev=797943&r1=797942&r2=797943&view=diff
==============================================================================
--- 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>
 
-  <para>The template path must have an <varname>.htm</varname> extension
which
+  <para>The template path should have an <varname>.htm</varname> extension
which
   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>
 
-  <para>If you use JSP pages for rendering the <varname>.jsp</varname>
extension
+  <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
path)</ulink>
+  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>
extension
   must be used. For example:
   </para>
 



Mime
View raw message