joerg 2003/10/16 14:47:01
Added: site/2.1/userdocs/concepts modules-ref.html modules-ref.pdf Log: missing pages added Revision Changes Path 1.1 cocoon-site/site/2.1/userdocs/concepts/modules-ref.html Index: modules-ref.html =================================================================== <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Input Modules Reference</title> <link type="text/css" href="../../skin/page.css" rel="stylesheet"> </head> <body text="#000000" bgcolor="#FFFFFF"> <!--================= start Navigation Path ==================--> <table summary="navigation path" width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td nowrap="nowrap" valign="middle" bgcolor="#CFDCED" height="20"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><!--===== breadcrumb trail (javascript-generated) ====--><font size="2" face="Arial, Helvetica, Sans-serif"><script src="../../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script></font></td> </tr> <tr> <td bgcolor="#4C6C8F" height="2"><img height="2" width="2" alt="" src="../../skin/images/spacer.gif" class="spacer"></td> </tr> </table> <!--================= end Navigation Path ==================--> <!--================= start Banner ==================--> <table summary="header with logos" width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <!--================= start Group Logo ==================--> <td bgcolor="#294563"><a href="http://cocoon.apache.org/"><img border="0" class="logoImage" alt="Apache Cocoon" src="../../images/cocoon-project-logo.png"></a></td> <!--================= end Group Logo ==================--> <!--================= start Project Logo ==================--><td width="100%" align="center" bgcolor="#294563"><a href="http://cocoon.apache.org/"><img border="0" class="logoImage" alt="Apache Cocoon" src="../../images/project-logo.gif"></a></td> <!--================= end Project Logo ==================--> <!--================= start Search ==================--><td valign="top" rowspan="2" bgcolor="#294563"> <form target="_blank" action="http://www.google.com/search" method="get"> <table summary="search" border="0" cellspacing="0" cellpadding="0" bgcolor="#4C6C8F"> <tr> <td colspan="3"><img height="10" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td> </tr> <tr> <td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap"><input value="cocoon.apache.org" name="sitesearch" type="hidden"><input size="15" name="q" id="query" type="text"><img height="1" width="5" alt="" src="../../skin/images/spacer.gif" class="spacer"><input name="Search" value="Search" type="submit"> <br> <font face="Arial, Helvetica, Sans-serif" size="2" color="white"> the Apache Cocoon site </font></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td> </tr> <tr> <td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-left.gif"></td><td><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td><img alt="" border="0" height="10" width="9" src="../../skin/images/search-right.gif"></td> </tr> </table> </form> </td> <!--================= start Search ==================--><td bgcolor="#294563"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td> </tr> <tr> <td valign="bottom" bgcolor="#294563" colspan="2"> <!--================= start Tabs ==================--> <div class="tab"> <table summary="tab bar" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="6"><img alt="" height="8" width="6" src="../../skin/images/spacer.gif"></td><td valign="bottom"> <table summary="selected tab" style="height: 1.8em" border="0" cellpadding="0" cellspacing="0"> <tr> <td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-left.gif"></td><td valign="middle" bgcolor="#4C6C8F"><font color="#ffffff" size="2" face="Arial, Helvetica, Sans-serif"><b><a class="base-selected" href="../../index.html">Home</a></b></font></td><td valign="top" width="5" bgcolor="#4C6C8F"><img height="5" width="5" alt="" src="../../skin/images/tabSel-right.gif"></td> </tr> </table> </td> </tr> </table> </div> <!--================= end Tabs ==================--> </td><td bgcolor="#294563"><img alt="" width="1" height="1" src="../../skin/images/spacer.gif" class="spacer"></td> </tr> <tr> <td bgcolor="#4C6C8F" colspan="4"><img width="1" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td> </tr> </table> <!--================= end Banner ==================--> <!--================= start Menu, NavBar, Content ==================--> <table summary="page content" bgcolor="#ffffff" width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td valign="top"> <table summary="menu" border="0" cellspacing="0" cellpadding="0"> <tr> <!--================= start left top NavBar ==================--> <td rowspan="3" valign="top"> <table summary="blue line" border="0" cellpadding="0" cellspacing="0"> <tr> <td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td> </tr> <tr> <td bgcolor="#CFDCED"><font color="#4C6C8F" size="4" face="Arial, Helvetica, Sans-serif"> </font></td> </tr> <tr> <td bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td> </tr> </table> </td> <!--================= end left top NavBar ==================--><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td nowrap="nowrap" valign="top" bgcolor="#4C6C8F"> <!--================= start Menu items ==================--> <div class="menu"> <ul> <li> <font color="#CFDCED">Navigation</font> <ul> <li> <a href="../../index.html">Main</a> </li> <li> <a href="../index.html">User Documentation</a> </li> </ul> </li> <li> <font color="#CFDCED">Concepts</font> <ul> <li> <a href="index.html">Overview</a> </li> <li> <a href="sitemap.html">Sitemap</a> </li> <li> <a href="views.html">Views</a> </li> <li> <a href="caching.html">Caching</a> </li> <li> <a href="actions.html">Actions</a> </li> <li> <a href="matchers_selectors.html">Matchers and Selectors</a> </li> <li> <a href="catalog.html">Entity Catalogs</a> </li> <li> <a href="mrustore.html">MRUMemoryStore</a> </li> <li> <a href="persistence.html">Persistence</a> </li> <li> <a href="storejanitor.html">StoreJanitor</a> </li> <li> <a href="xmlsearching.html">XMLSearching</a> </li> <li> <a href="xmlform.html">XMLForm</a> </li> <li> <a href="validation.html">XML Validation</a> </li> <li> <a href="databases.html">Databases</a> </li> <li> <a href="modules.html">Modules</a> </li> <li> <span class="sel"><font color="#ffcc00">Modules Reference</font></span> </li> <li> <a href="redirection.html">Redirection</a> </li> <li> <a href="profiler.html">Profiler</a> </li> <li> <a href="errorhandling.html">Error Handling</a> </li> </ul> </li> </ul> </div> <!--================= end Menu items ==================--> </td><td valign="bottom" bgcolor="#4C6C8F"><img width="10" height="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td> </tr> <tr> <td valign="bottom" align="left" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-left.gif"></td><td bgcolor="#4C6C8F"><img height="10" width="10" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td valign="bottom" align="right" colspan="2" rowspan="2" bgcolor="#4C6C8F"><img height="10" width="10" border="0" alt="" src="../../skin/images/menu-right.gif"></td> </tr> <tr> <td height="1" bgcolor="#294563"><img width="1" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td> </tr> </table> </td><td valign="top" width="100%"> <table summary="content" width="100%" border="0" cellpadding="0" cellspacing="0"> <!--================= start middle NavBar ==================--> <tr> <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td> </tr> <tr> <td align="left" width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="left" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif"> </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td align="right" width="50%" bgcolor="#CFDCED"><font color="#4C6C8F" size="3" face="Arial, Helvetica, Sans-serif"> </font><img width="10" height="8" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td width="10" bgcolor="#CFDCED"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td> </tr> <tr> <td colspan="4" bgcolor="#294563"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td> </tr> <!--================= end middle NavBar ==================--> <!--================= start Content==================--> <tr> <td align="left" width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td><td colspan="2" align="left" width="100%"> <div class="content"> <table class="title" summary=""> <tr> <td valign="middle"> <h1>Input Modules Reference</h1> </td><script language="Javascript" type="text/javascript"> function printit() { if (window.print) { window.print() ; } else { var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH="0" HEIGHT="0" CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>'; document.body.insertAdjacentHTML('beforeEnd', WebBrowser); WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box WebBrowser1.outerHTML = ""; } } </script><script language="Javascript" type="text/javascript"> var NS = (navigator.appName == "Netscape"); var VERSION = parseInt(navigator.appVersion); if (VERSION > 3) { document.write('<td nowrap="nowrap" width="40" align="center">'); document.write(' <a class="dida" href="javascript:printit()">'); document.write(' <img alt="Print this Page" src="../../skin/images/printer.gif" class="skin"><br>'); document.write(' print</a>'); document.write('</td>'); } </script><td nowrap="nowrap" width="40" align="center"><a class="dida" href="modules-ref.pdf"><img alt="PDF" src="../../skin/images/pdfdoc.gif" class="skin"><br> PDF</a></td> </tr> </table> <p>A concise reference to Cocoon's InputModules.</p> <ul class="minitoc"> <li> <a href="#Introduction">Introduction</a> </li> <li> <a href="#Modules+Reference">Modules Reference</a> <ul class="minitoc"> <li> <a href="#AbstractInputModule">AbstractInputModule</a> </li> <li> <a href="#AbstractJXPathModule">AbstractJXPathModule</a> </li> <li> <a href="#AbstractMetaModule">AbstractMetaModule</a> </li> <li> <a href="#CollectionMetaModule">CollectionMetaModule</a> </li> <li> <a href="#DateInputModule">DateInputModule</a> </li> <li> <a href="#GlobalInputModule">GlobalInputModule</a> </li> <li> <a href="#RawRequestParameterModule">RawRequestParameterModule</a> </li> <li> <a href="#RequestParameterModule">RequestParameterModule</a> </li> <li> <a href="#RequestURIModule">RequestURIModule</a> </li> </ul> </li> </ul> <a name="N10016"></a><a name="Introduction"></a> <h3>Introduction</h3> <div style="margin-left: 0 ; border: 2px"> <p>This is meant to be a concise reference to Cocoon's InputModules, what they do, and how to use them. InputModules are available in Cocoon 2.0.4 and above. Many descriptions are taken directly from the respective modules' source code, or from trial and error experimentation.</p> <div class="frame note"> <div class="label">Note</div> <div class="content">See also: the <a href="http://wiki.cocoondev.org/Wiki.jsp?page=InputModules">InputModules Wiki Page</a>.</div> </div> </div> <a name="N10027"></a><a name="Modules+Reference"></a> <h3>Modules Reference</h3> <div style="margin-left: 0 ; border: 2px"> <a name="N1002D"></a><a name="AbstractInputModule"></a> <h4>AbstractInputModule</h4> <div style="margin-left: 0 ; border: 2px"> <p>AbstractInputModule gives you the infrastructure for easily deploying more InputModules.</p> </div> <a name="N10037"></a><a name="AbstractJXPathModule"></a> <h4>AbstractJXPathModule</h4> <div style="margin-left: 0 ; border: 2px"> <p>JXPathModule allows to access properties of any object in generic way. JXPath provides APIs for the traversal of graphs of JavaBeans, DOM and other types of objects using the XPath syntax. JXPathMetaModule is based on this class and duplicates the code since multiple inheritance is not possible. Please keep both classes in sync.</p> <p> <strong>Configuration Example:</strong> </p> <p>The following imports the class "String" as extension class to the JXPathContext using the prefix "str". Thus "str:length(xpath)" would apply the method "length" to the string object obtained from the xpath expression. Please note that the class needs to be fully qualified.</p> <pre class="code"><function name="java.lang.String" prefix="str"/></pre> <p>The following imports all classes in the package "java.util" as extension classes to the JXPathContext using the prefix "util". Thus "util:Date.new()" would create a new java.util.Date object.</p> <pre class="code"><package name="java.util" prefix="util"/></pre> </div> <a name="N10055"></a><a name="AbstractMetaModule"></a> <h4>AbstractMetaModule</h4> <div style="margin-left: 0 ; border: 2px"> <p>AbstractMetaModule gives you the infrastructure for easily deploying more "meta" InputModules i.e. InputModules that are composed of other InputModules. In order to get at the Logger, use getLogger().</p> </div> <a name="N1005F"></a><a name="CollectionMetaModule"></a> <h4>CollectionMetaModule</h4> <div style="margin-left: 0 ; border: 2px"> <p>Constructs an array of values suitable for a JDBC collection type from parameters obtained from another input module. Application is not limited to JDBC collections but can be used wherever similar named attributes shall be collected to an array of a given type. Currently, long, int, and string are known, more to come.</p> <p> <strong>Global and Local Configuration:</strong> </p> <div class="frame fixme"> <div class="label">Fixme (TC)</div> <div class="content">Finish the reference for this Module.</div> </div> </div> <a name="N10071"></a><a name="DateInputModule"></a> <h4>DateInputModule</h4> <div style="margin-left: 0 ; border: 2px"> <p>This module returns the current date, optionally formated as string. Format given through attribute "format" of configuration root node or nested <format/> tag on module declaration.</p> <div class="frame note"> <div class="label">Note</div> <div class="content">The 'format' attribute doesn't seem to work. Nested <span class="codefrag"><format/></span> tags work fine.</div> </div> <div class="frame note"> <div class="label">Note</div> <div class="content">See also: <a href="http://java.sun.com/j2se/1.4.1/docs/api/java/text/SimpleDateFormat.html">Java Date Format</a>.</div> </div> </div> <a name="N10088"></a><a name="GlobalInputModule"></a> <h4>GlobalInputModule</h4> <div style="margin-left: 0 ; border: 2px"> <p>This module allows you to access "global" variables which are defined in a sitemap's pipelines definition.</p> <p> <strong>cocoon.xconf usage:</strong> </p> <pre class="code"> <input-modules> ... <component-instance class="org.apache.cocoon.components.modules.input.GlobalInputModule" logger="core.modules.input" name="global"/> ... </input-modules> </pre> <p> <strong>Sitemap Usage:</strong> </p> <pre class="code"> <map:component-configurations> <global-variables> <doc>doc.xml</doc> </global-variables> </map:component-configurations> </pre> <p> <strong>Example Pipeline Fragment:</strong> </p> <pre class="code"> <map:match pattern="foo"> <map:generate type="file" src="documents/{global:doc}"/> <map:transform src="stylesheets/foo2html.xsl"/> <map:serialize/> </map:match> </pre> </div> <a name="raw-request-parameter-module"></a><a name="N100B0"></a><a name="RawRequestParameterModule"></a> <h4>RawRequestParameterModule</h4> <div style="margin-left: 0 ; border: 2px"> <p>This module allows access to "raw" request parameters and their values.</p> <p>Values returned are "URL Encoded", meaning if a parameter is submitted as "foo+bar", you will get the string "foo+bar".</p> <div class="frame note"> <div class="label">Note</div> <div class="content">For access to URL-Decoded request parameters, see the <a href="#request-parameter-module">RequestParameterModule</a>.</div> </div> <p> <strong>cocoon.xconf usage:</strong> </p> <pre class="code"> <input-modules> ... <component-instance class="org.apache.cocoon.components.modules.input.RawRequestParameterModule" logger="core.modules.input" name="raw-request-param"/> ... </input-modules> </pre> <p> <strong>Example Pipeline Fragment:</strong> </p> <pre class="code"> <map:match pattern="amazonProxy"> <map:generate type="file" src="http://localhost:8888/search?qry={raw-request-param:actor}"/> <map:serialize type="xml"/> </map:match> </pre> <p> This input module is useful when you are querying a remote service, and you need to be able to send a search string with spaces or other special characters intact. If you were to simply use <span class="codefrag">{request-param:actor}</span>, you would end up sending a space character to the remote service, which would be an error, since <a href="http://www.faqs.org/rfcs/rfc1738.html">RFC 1738</a> requires spaces and other special characters to be correctly encoded. </p> </div> <a name="request-parameter-module"></a><a name="N100E3"></a><a name="RequestParameterModule"></a> <h4>RequestParameterModule</h4> <div style="margin-left: 0 ; border: 2px"> <p>This module allows access to request parameters. Values returned are "URL Decoded". That is, if a request parameter is submitted as <span class="codefrag">foo+bar</span>, you will get the string "foo bar".</p> <div class="frame note"> <div class="label">Note</div> <div class="content">For URL-Encoded request parameters, see the <a href="#raw-request-parameter-module">RawRequestParameterModule</a>.</div> </div> <p> <strong>cocoon.xconf usage:</strong> </p> <pre class="code"> <input-modules> ... <component-instance class="org.apache.cocoon.components.modules.input.RequestParameterModule" logger="core.modules.input" name="request-param"/> ... </input-modules> </pre> <p> <strong>Example Pipeline Fragment:</strong> </p> <pre class="code"> <map:match pattern="bar"> <map:generate type="file" src="documents/{request-param:file}"/> <map:transform src="stylesheets/{request-param:stylesheet}"/> <map:serialize/> </map:match> </pre> <p>This pipeline will match a request for "bar" and pass the request parameters "file" and "stylesheet" to the generator and transformer, respectively. (e.g. http://localhost:8080/cocoon/bar?file=doc.xml&stylesheet=main.xsl).</p> <div class="frame warning"> <div class="label">Warning</div> <div class="content"> Directly passing request parameters for file access can be dangerous. Remember to follow basic webapp safety rules when designing your pipelines, and when passing around request parameters. </div> </div> </div> <a name="N1010F"></a><a name="RequestURIModule"></a> <h4>RequestURIModule</h4> <div style="margin-left: 0 ; border: 2px"> <p>Returns the URI of the request.</p> <p>If you are familliar with Avalon and Cocoon's component architecture, the following will explain what is specifically returned:</p> <pre class="code">String uri = ObjectModelHelper.getRequest(objectModel).getSitemapURI();</pre> <p> <strong>cocoon.xconf usage:</strong> </p> <pre class="code"> <input-modules> ... <component-instance class="org.apache.cocoon.components.modules.input.RequestURIModule" logger="core.modules.input" name="request-uri"/> ... </input-modules> </pre> <p> <strong>Example Sitemap Usage:</strong> </p> <pre class="code">{request-uri:requestURI}</pre> <p>This is how you would use the module most of the time, since the module only returns one item, the Request URI.</p> <div class="frame note"> <div class="label">Note</div> <div class="content"> The same effect can be achieved by passing the parameter name "sitemapURI" to the request module. Therefore this component is not declared in cocoon.xconf by default. You must manually add it. </div> </div> </div> </div> <div class="attribution">by Tony Collen</div> </div> </td><td width="10"><img width="10" height="1" alt="" src="../../skin/images/spacer.gif" class="spacer"></td> </tr> <!--================= end Content==================--> </table> </td> </tr> </table> <!--================= end Menu, NavBar, Content ==================--> <!--================= start Footer ==================--> <table summary="footer" cellspacing="0" cellpadding="0" width="100%" border="0"> <tr> <td colspan="2" height="1" bgcolor="#4C6C8F"><img height="1" width="1" alt="" src="../../skin/images/spacer.gif" class="spacer"><a href="../../skin/images/label.gif"></a><a href="../../skin/images/page.gif"></a><a href="../../skin/images/chapter.gif"></a><a href="../../skin/images/chapter_open.gif"></a><a href="../../skin/images/current.gif"></a><a href="/favicon.ico"></a></td> </tr> <tr> <td colspan="2" bgcolor="#CFDCED" class="copyright" align="center"><font size="2" face="Arial, Helvetica, Sans-Serif">Copyright © 1999-2003 The Apache Software Foundation. All rights reserved.<script type="text/javascript" language="JavaScript"><!-- document.write(" - "+"Last Published: " + document.lastModified); // --></script></font></td> </tr> <tr> <td colspan="2" align="left" bgcolor="#CFDCED" class="logos"></td> </tr> </table> <!--================= end Footer ==================--> </body> </html> 1.1 cocoon-site/site/2.1/userdocs/concepts/modules-ref.pdf <<Binary file>>