You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by do...@cocoon.apache.org on 2004/07/08 21:12:03 UTC
[Cocoon Wiki] Updated: InputModules
Date: 2004-07-08T12:12:02
Editor: GregorRothfuss <gr...@apache.org>
Wiki: Cocoon Wiki
Page: InputModules
URL: http://wiki.apache.org/cocoon/InputModules
no comment
Change Log:
------------------------------------------------------------------------------
@@ -58,7 +58,7 @@
=== DateInputModule returns current date, optionally formated as string. Format given through attribute "format" of configuration root node or nested ==={{{<format/>}}} tag on module declaration.
- * [http://java.sun.com/j2se/1.4.1/docs/api/java/text/SimpleDateFormat.html Java Date Format]
+ * [http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html Java Date Format]
'''Note:''' 'format' attribute doesn't seem to work. Nested {{{<format/>}}} tags work fine.
@@ -69,30 +69,30 @@
'''cocoon.xconf usage''':
-{{{
-<component-instance
- class="org.apache.cocoon.components.modules.input.GlobalInputModule"
- logger="core.modules.input"
- name="global"/>
+{{{
+<component-instance
+ class="org.apache.cocoon.components.modules.input.GlobalInputModule"
+ logger="core.modules.input"
+ name="global"/>
}}}
'''sitemap.xmap usage''':
-{{{
-<map:component-configurations>
- <global-variables>
- <doc>doc.xml</doc>
- </global-variables>
-</map:component-configurations>
+{{{
+<map:component-configurations>
+ <global-variables>
+ <doc>doc.xml</doc>
+ </global-variables>
+</map:component-configurations>
}}}
'''Example Pipeline Fragment''':
-{{{
-<map:match pattern="foo">
- <map:generate type="file" src="documents/{global:doc}"/>
- <map:transform src="stylesheets/foo2html.xsl"/>
- <map:serialize/>
-</map:match>
+{{{
+<map:match pattern="foo">
+ <map:generate type="file" src="documents/{global:doc}"/>
+ <map:transform src="stylesheets/foo2html.xsl"/>
+ <map:serialize/>
+</map:match>
}}}
----
@@ -100,11 +100,11 @@
Returns a random number (between 0 and 9999999999, user-configurable) as a string.
'''cocoon.xconf usage''':
-{{{
-<component-instance
- class="org.apache.cocoon.components.modules.input.RandomNumberModule"
- logger="core.modules.input"
- name="random"/>
+{{{
+<component-instance
+ class="org.apache.cocoon.components.modules.input.RandomNumberModule"
+ logger="core.modules.input"
+ name="random"/>
}}}
||'''Accessor'''||||Description
@@ -120,20 +120,20 @@
For access to URL-Decoded request parameters, see the !RequestParameterModule.
'''cocoon.xconf usage''':
-{{{
-<component-instance
- class="org.apache.cocoon.components.modules.input.RawRequestParameterModule"
- logger="core.modules.input"
- name="raw-request-param"/>
+{{{
+<component-instance
+ class="org.apache.cocoon.components.modules.input.RawRequestParameterModule"
+ logger="core.modules.input"
+ name="raw-request-param"/>
}}}
'''Example Pipeline Fragment''':
-{{{
-<map:match pattern="fooProxy">
- <map:generate type="file"
- src="http://xml.foo.com/onca/foo?foo={raw-request-param:foo}"/>
- <map:serialize type="xml"/>
-</map:match>
+{{{
+<map:match pattern="fooProxy">
+ <map:generate type="file"
+ src="http://xml.foo.com/onca/foo?foo={raw-request-param:foo}"/>
+ <map:serialize type="xml"/>
+</map:match>
}}}
This input module is useful when you are querying a remote service (in this example, a fictional 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 {{ {request-param:foo} }}, you could end up sending a space character to the remote service, which would be an error, since [http://www.faqs.org/rfcs/rfc1738.html RFC 1738] requires spaces and other special characters to be correctly encoded.
@@ -184,11 +184,11 @@
For a complete listing of all available properties, see the [http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/environment/Request.html Cocoon Request API Docs].
'''cocoon.xconf usage''':
-{{{
-<component-instance
- class="org.apache.cocoon.components.modules.input.RequestModule"
- logger="core.modules.input"
- name="request"/>
+{{{
+<component-instance
+ class="org.apache.cocoon.components.modules.input.RequestModule"
+ logger="core.modules.input"
+ name="request"/>
}}}
----
@@ -202,25 +202,25 @@
If you have multiple parameters with the same name, and want to get one of them, say the 2nd one, you'll have to use the {{{RequestModule}}}, that has {{{JXPath}}} features, like in this sample:
-{{{
-<map:parameter name='my-parameter' value='{request:getParameterValues(.,"myParameter")[2]}'/>
+{{{
+<map:parameter name='my-parameter' value='{request:getParameterValues(.,"myParameter")[2]}'/>
}}}
'''cocoon.xconf usage''':
-{{{
-<component-instance
- class="org.apache.cocoon.components.modules.input.RequestParameterModule"
- logger="core.modules.input"
- name="request-param"/>
+{{{
+<component-instance
+ class="org.apache.cocoon.components.modules.input.RequestParameterModule"
+ logger="core.modules.input"
+ name="request-param"/>
}}}
'''Example Pipeline Fragment''':
-{{{
-<map:match pattern="bar">
- <map:generate type="file" src="documents/{request-param:file}"/>
- <map:transform src="stylesheets/{request-param:stylesheet}"/>
- <map:serialize/>
-</map:match>
+{{{
+<map:match pattern="bar">
+ <map:generate type="file" src="documents/{request-param:file}"/>
+ <map:transform src="stylesheets/{request-param:stylesheet}"/>
+ <map:serialize/>
+</map:match>
}}}
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'').
@@ -231,16 +231,16 @@
Returns the URI of the request. Specifically:
-{{{
-String uri = ObjectModelHelper.getRequest(objectModel).getSitemapURI();
+{{{
+String uri = ObjectModelHelper.getRequest(objectModel).getSitemapURI();
}}}
'''cocoon.xconf usage''':
-{{{
-<component-instance
- class="org.apache.cocoon.components.modules.input.RequestURIModule"
- logger="core.modules.input"
- name="request-uri"/>
+{{{
+<component-instance
+ class="org.apache.cocoon.components.modules.input.RequestURIModule"
+ logger="core.modules.input"
+ name="request-uri"/>
}}}
'''Note''': 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.
@@ -258,11 +258,11 @@
Access various information about a session.
'''cocoon.xconf usage''':
-{{{
-<component-instance
- class="org.apache.cocoon.components.modules.input.SessionModule"
- logger="core.modules.input"
- name="session"/>
+{{{
+<component-instance
+ class="org.apache.cocoon.components.modules.input.SessionModule"
+ logger="core.modules.input"
+ name="session"/>
}}}
The following is not a complete list; For a complete listing of all available accessors, the [http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/environment/Session.html Cocoon Session API Docs] may be useful.
@@ -281,11 +281,11 @@
Access session attributes.
'''cocoon.xconf usage''':
-{{{
-<component-instance
- class="org.apache.cocoon.components.modules.input.SessionAttributeModule"
- logger="core.modules.input"
- name="session-attr"/>
+{{{
+<component-instance
+ class="org.apache.cocoon.components.modules.input.SessionAttributeModule"
+ logger="core.modules.input"
+ name="session-attr"/>
}}}
'''Example Sitemap Usage''':
@@ -300,11 +300,11 @@
This module allows you to access system properties as returned by {{{System.getProperties()}}}. (See also: [http://java.sun.com/j2se/1.4.1/docs/api/java/lang/System.html#getProperties() System.getProperties])
'''cocoon.xconf usage''':
-{{{
-<component-instance
- class="org.apache.cocoon.components.modules.input.SystemPropertyModule"
- logger="core.modules.input"
- name="system-property"/>
+{{{
+<component-instance
+ class="org.apache.cocoon.components.modules.input.SystemPropertyModule"
+ logger="core.modules.input"
+ name="system-property"/>
}}}
----
@@ -317,14 +317,14 @@
Caching and reloading can be turned on / off (default: on) through {{{<reloadable>false</reloadable>}}} and {{{<cacheable>false</cacheable>}}}. The file (source) to use is specified through {{{<file src="protocol:path/to/file.xml" reloadable="true" cacheable="true"/>}}} optionally overriding defaults for caching and or reloading.
'''cocoon.xconf usage''':
-{{{
-<component-instance
- class="org.apache.cocoon.components.modules.input.XMLFileModule"
- logger="core.modules.xml"
- name="myxml">
-
- <file src="context:///samples/modules/forrestconf.xml"/>
-</component-instance>
+{{{
+<component-instance
+ class="org.apache.cocoon.components.modules.input.XMLFileModule"
+ logger="core.modules.xml"
+ name="myxml">
+
+ <file src="context:///samples/modules/forrestconf.xml"/>
+</component-instance>
}}}
----