| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| |
| <!--+ |
| | This is the 'heart' of Cocoon. The sitemap maps URI space to |
| | resources. It consists basicaly of two parts: components and |
| | pipelines. Pipelines are made out of components. There is such a |
| | vast number of components available that it would be impossible to |
| | describe them here, please refer to the accompanying |
| | documentation. For specific components, have a look also at the |
| | javadocs for them. Most pipelines are present to demonstrate some |
| | feature or technique, often they are explained in more detail in |
| | the accompanying documentation. The sitemaps which come with each |
| | sample and each block will help to explain. |
| | |
| | CVS $Id$ |
| +--> |
| <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"> |
| |
| <!-- =========================== Components ================================ --> |
| |
| <map:components> |
| |
| <!--+ |
| | All pipelines consist at least of two components: a generator, that |
| | produces the content, and a serialiser, that delivers the content to |
| | the client. |
| | |
| | More precisely: a generator generates SAX events and a serializer |
| | consumes these events and produces a byte stream. |
| | |
| | Some things to note here: each generator has a unique name, this |
| | name is mapped to a java class, one name is declared as the default |
| | generator. Each generator may have additional configurations as |
| | child elements. |
| | |
| | Additional attributes are targeted at the component manager. The optional |
| | "label" attribute is relevant for the view concept below. The optional |
| | "logger" attribute defines the logging category where messages produced |
| | by a component should go. If there's no "logger" attribute, the category |
| | used is the one defined for the "sitemap" component in cocoon.xconf. |
| | |
| | We have chosen in this sitemap to use a different logging category |
| | for each component, which allows fine-grained classification of log |
| | messages. But you are free to use any category you want. |
| | |
| | It is possible to have the same java class declared as different |
| | generators by using different names. No configuration options are |
| | shared between these instances, however. |
| | |
| | All components follow this scheme. |
| +--> |
| <map:generators default="file"> |
| <map:generator label="content" logger="sitemap.generator.file" name="file" pool-max="${file-generator.pool-max}" src="org.apache.cocoon.generation.FileGenerator"/> |
| <map:generator label="content" logger="sitemap.generator.directory" name="directory" pool-max="${directory-generator.pool-max}" src="org.apache.cocoon.generation.DirectoryGenerator"/> |
| <map:generator label="content" logger="sitemap.generator.xpathdirectory" name="xpathdirectory" src="org.apache.cocoon.generation.XPathDirectoryGenerator"/> |
| <map:generator label="content" logger="sitemap.generator.imagedirectory" name="imagedirectory" src="org.apache.cocoon.generation.ImageDirectoryGenerator"/> |
| <map:generator label="content" logger="sitemap.generator.mp3directory" name="mp3directory" src="org.apache.cocoon.generation.MP3DirectoryGenerator"/> |
| <map:generator label="content" logger="sitemap.generator.request" name="request" pool-max="${request-generator.pool-max}" src="org.apache.cocoon.generation.RequestGenerator"/> |
| <map:generator label="content" logger="sitemap.generator.stream" name="stream" pool-max="${stream-generator.pool-max}" src="org.apache.cocoon.generation.StreamGenerator"/> |
| <map:generator label="content" logger="sitemap.generator.status" name="status" pool-max="${status-generator.pool-max}" src="org.apache.cocoon.generation.StatusGenerator"/> |
| <map:generator label="content" logger="sitemap.generator.jx" name="jx" pool-max="${jx-generator.pool-max}" src="org.apache.cocoon.generation.JXTemplateGenerator"/> |
| <!-- The notifying generator can only be used in a <handle-errors> section --> |
| <map:generator name="notifying" src="org.apache.cocoon.sitemap.NotifyingGenerator"/> |
| <!-- The exception generator can only be used in a <handle-errors> section : it produces an XML |
| representation of the exception that caused the error handler to be executed --> |
| <map:generator name="exception" src="org.apache.cocoon.generation.ExceptionGenerator"/> |
| </map:generators> |
| |
| |
| <!--+ |
| | Transformers can be placed inside the pipeline between the generator |
| | and the serializer. You may have as many transformers as you |
| | like. Transformers consume SAX events and emit SAX events. |
| | |
| | The "xslt" transformer is an example of a component with additional |
| | configuration. |
| +--> |
| <map:transformers default="xslt"> |
| |
| <!-- NOTE: This is the default XSLT processor. --> |
| <map:transformer logger="sitemap.transformer.xslt" name="xslt" pool-max="${xslt-transformer.pool-max}" src="org.apache.cocoon.transformation.TraxTransformer"> |
| <use-request-parameters>false</use-request-parameters> |
| <use-session-parameters>false</use-session-parameters> |
| <use-cookie-parameters>false</use-cookie-parameters> |
| <xslt-processor-role>xalan</xslt-processor-role> |
| <check-includes>true</check-includes> |
| </map:transformer> |
| |
| <!-- NOTE: This is the same as the default processor but with a different name (for compatibility) --> |
| <map:transformer logger="sitemap.transformer.xalan" name="xalan" pool-max="${xalan-transformer.pool-max}" src="org.apache.cocoon.transformation.TraxTransformer"> |
| <use-request-parameters>false</use-request-parameters> |
| <use-session-parameters>false</use-session-parameters> |
| <use-cookie-parameters>false</use-cookie-parameters> |
| <xslt-processor-role>xalan</xslt-processor-role> |
| <check-includes>true</check-includes> |
| </map:transformer> |
| |
| <!-- NOTE: You can also try XSLTC as the default processor. If you use Xalan extensions, use the "xalan" transformer. --> |
| <map:transformer logger="sitemap.transformer.xsltc" name="xsltc" pool-max="${xsltc-transformer.pool-max}" src="org.apache.cocoon.transformation.TraxTransformer"> |
| <use-request-parameters>false</use-request-parameters> |
| <use-session-parameters>false</use-session-parameters> |
| <use-cookie-parameters>false</use-cookie-parameters> |
| <xslt-processor-role>xsltc</xslt-processor-role> |
| <check-includes>true</check-includes> |
| </map:transformer> |
| |
| <map:transformer logger="sitemap.transformer.include" name="include" pool-max="${include-transformer.pool-max}" src="org.apache.cocoon.transformation.IncludeTransformer"/> |
| <map:transformer logger="sitemap.transformer.xinclude" name="xinclude" pool-max="${xinclude-transformer.pool-max}" src="org.apache.cocoon.transformation.XIncludeTransformer"/> |
| <map:transformer logger="sitemap.transformer.cinclude" name="cinclude" pool-max="${cinclude-transformer.pool-max}" src="org.apache.cocoon.transformation.CIncludeTransformer"/> |
| <map:transformer logger="sitemap.transformer.encodeURL" name="encodeURL" pool-max="${encodeurl-transformer.pool-max}" src="org.apache.cocoon.transformation.EncodeURLTransformer"/> |
| <map:transformer logger="sitemap.transformer.write-source" name="write-source" src="org.apache.cocoon.transformation.SourceWritingTransformer"/> |
| <map:transformer logger="sitemap.transformer.jpath" name="jpath" src="org.apache.cocoon.transformation.JPathTransformer"/> |
| <map:transformer logger="sitemap.transformer.filter" name="filter" src="org.apache.cocoon.transformation.FilterTransformer"/> |
| <map:transformer logger="sitemap.transformer.writeDOMsession" name="writeDOMsession" src="org.apache.cocoon.transformation.WriteDOMSessionTransformer"/> |
| <map:transformer logger="sitemap.transformer.readDOMsession" name="readDOMsession" src="org.apache.cocoon.transformation.ReadDOMSessionTransformer"/> |
| <map:transformer logger="sitemap.transformer.log" name="log" pool-max="${log-transformer.pool-max}" src="org.apache.cocoon.transformation.LogTransformer"/> |
| <map:transformer logger="sitemap.transformer.jx" name="jx" pool-max="${jx-transformer.pool-max}" src="org.apache.cocoon.transformation.JXTemplateTransformer"/> |
| <map:transformer logger="sitemap.transformer.paginate" name="paginate" src="org.apache.cocoon.transformation.pagination.Paginator"/> |
| </map:transformers> |
| |
| |
| <!--+ |
| | Serializers consume SAX events and produce a character stream. Every |
| | pipeline needs to be terminated by a serializer. |
| +--> |
| <map:serializers default="html"> |
| <map:serializer logger="sitemap.serializer.links" name="links" src="org.apache.cocoon.serialization.LinkSerializer"/> |
| <map:serializer logger="sitemap.serializer.xml" mime-type="text/xml" name="xml" src="org.apache.cocoon.serialization.XMLSerializer"/> |
| |
| <map:serializer logger="sitemap.serializer.html" mime-type="text/html" name="html" pool-max="${html-serializer.pool-max}" src="org.apache.cocoon.serialization.HTMLSerializer"> |
| <doctype-public>-//W3C//DTD HTML 4.01 Transitional//EN</doctype-public> |
| <doctype-system>http://www.w3.org/TR/html4/loose.dtd</doctype-system> |
| </map:serializer> |
| |
| <map:serializer logger="sitemap.serializer.wml" mime-type="text/vnd.wap.wml" name="wml" src="org.apache.cocoon.serialization.XMLSerializer"> |
| <doctype-public>-//WAPFORUM//DTD WML 1.1//EN</doctype-public> |
| <doctype-system>http://www.wapforum.org/DTD/wml_1.1.xml</doctype-system> |
| <encoding>ASCII</encoding> |
| <omit-xml-declaration>yes</omit-xml-declaration> |
| </map:serializer> |
| |
| <map:serializer logger="sitemap.serializer.chtml" mime-type="text/html" name="chtml" src="org.apache.cocoon.serialization.HTMLSerializer"> |
| <!--+ |
| | Compact HTML for Small Information Appliances, |
| | based on http://www.w3.org/TR/1998/NOTE-compactHTML-19980209/ |
| + --> |
| <doctype-public>-//W3C//DTD Compact HTML 1.0 Draft//EN</doctype-public> |
| </map:serializer> |
| |
| <map:serializer logger="sitemap.serializer.svgxml" mime-type="image/svg+xml" name="svgxml" src="org.apache.cocoon.serialization.XMLSerializer"> |
| <doctype-public>-//W3C//DTD SVG 1.0//EN</doctype-public> |
| <doctype-system>http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd</doctype-system> |
| </map:serializer> |
| |
| <map:serializer logger="sitemap.serializer.xhtml" mime-type="text/html" name="xhtml" pool-max="${xhtml-serializer.pool-max}" src="org.apache.cocoon.serialization.XMLSerializer"> |
| <!--+ |
| | You can choose from Strict, Transitional, or Frameset XHTML. |
| | For Strict XHTML set doctype to: |
| | <doctype-public>-//W3C//DTD XHTML 1.0 Strict//EN</doctype-public> |
| | <doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</doctype-system> |
| | For Transitional XHTML set doctype to: |
| | <doctype-public>-//W3C//DTD XHTML 1.0 Transitional//EN</doctype-public> |
| | <doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</doctype-system> |
| | For Frameset XHTML set doctype to: |
| | <doctype-public>-//W3C//DTD XHTML 1.0 Frameset//EN</doctype-public> |
| | <doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd</doctype-system> |
| | |
| | Default XHTML doctype in Cocoon is XHTML Strict. If you want to use more than one |
| | XHTML DTD simultaneously, you can define several XHTML serializers. |
| +--> |
| <doctype-public>-//W3C//DTD XHTML 1.0 Strict//EN</doctype-public> |
| <doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</doctype-system> |
| <encoding>UTF-8</encoding> |
| </map:serializer> |
| |
| <map:serializer logger="sitemap.serializer.xhtml" mime-type="application/xhtml+xml" name="xhtml11" pool-max="${xhtml11-serializer.pool-max}" src="org.apache.cocoon.serialization.XMLSerializer"> |
| <doctype-public>-//W3C//DTD XHTML 1.1//EN</doctype-public> |
| <doctype-system>http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd</doctype-system> |
| <encoding>UTF-8</encoding> |
| </map:serializer> |
| |
| <map:serializer logger="sitemap.serializer.text" mime-type="text/plain" name="text" src="org.apache.cocoon.serialization.TextSerializer"/> |
| <map:serializer logger="sitemap.serializer.vrml" mime-type="model/vrml" name="vrml" src="org.apache.cocoon.serialization.TextSerializer"/> |
| <map:serializer logger="sitemap.serializer.zip" mime-type="application/zip" name="zip" src="org.apache.cocoon.serialization.ZipArchiveSerializer"/> |
| <map:serializer logger="sitemap.serializer.sxw" mime-type="application/vnd.sun.xml.writer" name="sxw" src="org.apache.cocoon.serialization.ZipArchiveSerializer"/> |
| <map:serializer logger="sitemap.serializer.sxc" mime-type="application/vnd.sun.xml.calc" name="sxc" src="org.apache.cocoon.serialization.ZipArchiveSerializer"/> |
| <map:serializer logger="sitemap.serializer.sxd" mime-type="application/vnd.sun.xml.draw" name="sxd" src="org.apache.cocoon.serialization.ZipArchiveSerializer"/> |
| <map:serializer logger="sitemap.serializer.sxi" mime-type="application/vnd.sun.xml.impress" name="sxi" src="org.apache.cocoon.serialization.ZipArchiveSerializer"/> |
| </map:serializers> |
| |
| |
| <!--+ |
| | Readers circumvent the XML oriented SAX pipeline model, think of a reader |
| | being a generator and a serializer at once thus a pipeline may not |
| | contain any generator, transformer or serializer in addition to a |
| | reader. They are useful for delivering binary content like images. |
| +--> |
| <map:readers default="resource"> |
| <map:reader logger="sitemap.reader.resource" name="resource" pool-max="${resource-reader.pool-max}" src="org.apache.cocoon.reading.ResourceReader"> |
| <!--+ |
| | Resource reader has these configuration parameters: |
| <expires>-1</expires> |
| <quick-modified-test>false</quick-modified-test> |
| <byte-ranges>true</byte-ranges> |
| <buffer-size>8192</buffer-size> |
| +--> |
| </map:reader> |
| <map:reader logger="sitemap.reader.image" name="image" src="org.apache.cocoon.reading.ImageReader"/> |
| </map:readers> |
| |
| <!--+ |
| | Matchers are executed during pipeline setup. They decide if a |
| | pipeline fragment is used within a pipeline. Usually, the decision |
| | is based on a match on the requested URI but matchers exist, that |
| | match different things as well. Most often the fragment contained in |
| | a matcher has a generator as well as a serializer. This is not a |
| | necessity, matchers can be nested while chaining does not work. |
| +--> |
| <map:matchers default="wildcard"> |
| <map:matcher logger="sitemap.matcher.wildcard" name="wildcard" src="org.apache.cocoon.matching.WildcardURIMatcher"/> |
| <map:matcher logger="sitemap.matcher.regexp" name="regexp" src="org.apache.cocoon.matching.RegexpURIMatcher"/> |
| <map:matcher logger="sitemap.matcher.request-parameter" name="request-parameter" src="org.apache.cocoon.matching.RequestParameterMatcher"/> |
| <map:matcher logger="sitemap.matcher.cookie" name="cookie" src="org.apache.cocoon.matching.CookieMatcher"/> |
| <map:matcher logger="sitemap.matcher.header" name="header" src="org.apache.cocoon.matching.HeaderMatcher"/> |
| <map:matcher logger="sitemap.matcher.parameter" name="parameter" src="org.apache.cocoon.matching.ParameterMatcher"/> |
| <map:matcher logger="sitemap.matcher.sessionstate" name="sessionstate" src="org.apache.cocoon.matching.WildcardSessionAttributeMatcher"> |
| <attribute-name>org.apache.cocoon.SessionState</attribute-name> |
| </map:matcher> |
| <map:matcher logger="sitemap.matcher.referer-match" name="referer-match" src="org.apache.cocoon.matching.WildcardHeaderMatcher"> |
| <header-name>referer</header-name> |
| </map:matcher> |
| <map:matcher name="mount-table" src="org.apache.cocoon.matching.MountTableMatcher"> |
| <map:parameter name="ignore-missing-tables" value="true"/> |
| </map:matcher> |
| <map:matcher logger="sitemap.matcher.locale" name="locale" src="org.apache.cocoon.matching.LocaleMatcher"> |
| <!--+ |
| | Default configuration: |
| <locale-attribute>locale</locale-attribute> |
| <negotiate>false</negotiate> |
| <use-locale>true</use-locale> |
| <use-locales>false</use-locales> |
| <use-blank-locale>true</use-blank-locale> |
| <default-locale language="en" country="US"/> |
| <create-session>false</create-session> |
| <store-in-request>false</store-in-request> |
| <store-in-session>false</store-in-session> |
| <store-in-cookie>false</store-in-cookie> |
| +--> |
| </map:matcher> |
| </map:matchers> |
| |
| <!--+ |
| | Selectors are executed during pipeline setup. They can be used to |
| | determine which pipeline fragments should be combined. They are best |
| | compared with a java switch statement. |
| +--> |
| <map:selectors default="browser"> |
| <map:selector logger="sitemap.selector.browser" name="browser" src="org.apache.cocoon.selection.BrowserSelector"> |
| <!--+ |
| | NOTE: The appearance indicates the search order. This is very important since |
| | some words may be found in more than one browser description. (MSIE is |
| | presented as "Mozilla/4.0 (Compatible; MSIE 4.01; ...") |
| +--> |
| <browser name="opera" useragent="Opera"/> |
| <browser name="explorer" useragent="MSIE"/> |
| <browser name="pocketexplorer" useragent="MSPIE"/> |
| <browser name="handweb" useragent="HandHTTP"/> |
| <browser name="avantgo" useragent="AvantGo"/> |
| <browser name="imode" useragent="DoCoMo"/> |
| <browser name="lynx" useragent="Lynx"/> |
| <browser name="java" useragent="Java"/> |
| <browser name="wap" useragent="Nokia"/> |
| <browser name="wap" useragent="UP"/> |
| <browser name="wap" useragent="Wapalizer"/> |
| <browser name="mozilla5" useragent="Mozilla/5"/> |
| <browser name="mozilla5" useragent="Netscape6/"/> |
| <browser name="netscape" useragent="Mozilla"/> |
| </map:selector> |
| |
| <!--+ |
| | Exception selector : used in <map:handle> errors to build different pipelines |
| | depending on the error that occured. |
| | The configuration allows to associate a symbolic name to exception classes |
| | which is used in the <map:when> tests. |
| | An exception can also be "unrolled", meaning that cascaded exception will be checked. |
| +--> |
| <map:selector logger="sitemap.selector.exception" name="exception" src="org.apache.cocoon.selection.ExceptionSelector"> |
| <exception name="not-found" class="org.apache.cocoon.ResourceNotFoundException"/> |
| <exception name="invalid-continuation" class="org.apache.cocoon.components.flow.InvalidContinuationException"/> |
| <!-- The statement below tells the selector to unroll as much exceptions as possible --> |
| <exception class="java.lang.Throwable" unroll="true"/> |
| </map:selector> |
| |
| <map:selector logger="sitemap.selector.request-method" name="request-method" src="org.apache.cocoon.selection.RequestMethodSelector"/> |
| <map:selector logger="sitemap.selector.resource-exists" name="resource-exists" src="org.apache.cocoon.selection.ResourceExistsSelector"/> |
| <map:selector logger="sitemap.selector.request-parameter" name="request-parameter" src="org.apache.cocoon.selection.RequestParameterSelector"> |
| <!--+ |
| | Define now which request parameter to use; or do it later, |
| | when using this selector, via "parameter-name" parameter. |
| <parameter-name>myparam</parameter-name> |
| +--> |
| </map:selector> |
| <map:selector logger="sitemap.selector.request-attribute" name="request-attribute" src="org.apache.cocoon.selection.RequestAttributeSelector"> |
| <!-- <attribute-name>myparam</attribute-name> --> |
| </map:selector> |
| <map:selector logger="sitemap.selector.session-attribute" name="session-attribute" src="org.apache.cocoon.selection.SessionAttributeSelector"> |
| <!-- <attribute-name>myparam</attribute-name> --> |
| </map:selector> |
| <map:selector logger="sitemap.selector.parameter" name="parameter" src="org.apache.cocoon.selection.ParameterSelector"/> |
| <map:selector logger="sitemap.selector.header" name="header" src="org.apache.cocoon.selection.HeaderSelector"> |
| <!-- <header-name>myparam</header-name> --> |
| </map:selector> |
| <map:selector logger="sitemap.selector.host" name="host" src="org.apache.cocoon.selection.HostSelector"/> |
| <map:selector logger="sitemap.selector.simple" name="simple" src="org.apache.cocoon.selection.SimpleSelector"/> |
| </map:selectors> |
| |
| |
| <!--+ |
| | Actions are executed during pipeline setup. Their purpose is to |
| | execute some code that doesn't involve touching the stream of |
| | pipeline events. Example usage is to update databases, check external |
| | resources, etc.. The execution may fail or complete successfully. Only |
| | if the execution of the action was successful, the pipeline fragment |
| | nested inside the action element is executed, otherwise, it's skipped |
| | entirely and execution proceeds from the element right below the action. |
| +--> |
| <map:actions> |
| <map:action logger="sitemap.action.request" name="request" src="org.apache.cocoon.acting.RequestParamAction"/> |
| <map:action logger="sitemap.action.requestParamExists" name="req-params" src="org.apache.cocoon.acting.RequestParameterExistsAction"/> |
| <map:action logger="sitemap.action.form-validator" name="form-validator" src="org.apache.cocoon.acting.FormValidatorAction"/> |
| <map:action logger="sitemap.action.session-state" name="session-state" src="org.apache.cocoon.acting.SessionStateAction"/> |
| <map:action logger="sitemap.action.session-isvalid" name="session-isvalid" src="org.apache.cocoon.acting.SessionIsValidAction"/> |
| <map:action logger="sitemap.action.session-validator" name="session-validator" src="org.apache.cocoon.acting.SessionValidatorAction"/> |
| <map:action logger="sitemap.action.session-invalidator" name="session-invalidator" src="org.apache.cocoon.acting.SessionInvalidatorAction"/> |
| <map:action logger="sitemap.action.resource-exists" name="resource-exists" src="org.apache.cocoon.acting.ResourceExistsAction"/> |
| <map:action logger="sitemap.action.set-header" name="set-header" src="org.apache.cocoon.acting.HttpHeaderAction"/> |
| <map:action logger="sitemap.action.clear-cache" name="clear-cache" src="org.apache.cocoon.acting.ClearCacheAction"/> |
| <map:action logger="sitemap.action.clear-persistent-store" name="clear-persistent-store" src="org.apache.cocoon.acting.ClearPersistentStoreAction"/> |
| <map:action logger="sitemap.action.locale" name="locale" src="org.apache.cocoon.acting.LocaleAction"> |
| <!--+ |
| | Default configuration: |
| <locale-attribute>locale</locale-attribute> |
| <create-session>false</create-session> |
| <store-in-request>false</store-in-request> |
| <store-in-session>false</store-in-session> |
| <store-in-cookie>false</store-in-cookie> |
| <use-locale>true</use-locale> |
| <default-locale language="en" country="US"/> |
| +--> |
| </map:action> |
| </map:actions> |
| |
| |
| <!--+ |
| | The different pipe implementations |
| | |
| | NON-CACHING: |
| | The non caching implementation of cocoon pipelines. |
| | |
| | CACHING: |
| | Traditional longest cacheable key caching. |
| | |
| | CACHING-POINT: |
| | The caching-point pipeline implements an extended |
| | caching algorithm which is of particular benefit for use with |
| | those pipelines that utilise cocoon-views and/or provide |
| | drill-down functionality. |
| | |
| | The autoCachingPoint algorithim (if enabled) will automatically |
| | cache common elements of the pipeline currently being processed - as well |
| | as the entire cacheable pipeline according to the "longest cacheable key" |
| | algorithm. |
| | |
| | Consider the following simple pipeline, where generator G is labelled with |
| | a cocoon-view enabling the pipeline to serialize data to either html or pdf |
| | depending on the value of cocoon-view (as provided by the request): |
| | G - T - S(html) |
| | |__ T - S(pdf) |
| | |
| | If cocoon-view=html, then the caching-point algorithm will not only cache |
| | the longest cacheable path, which would be GTS(html) but also the |
| | *common element* which in this case would be the results from G. If the |
| | next request to this pipeline was cocoon-view=pdf, then there would be no |
| | need to invoke the generator a second time, as it's value has already been |
| | cached (provided G generates the same cache key) |
| | |
| | Also note: One can switch "Off" autoCachingPoint and use "pipeline-hints" to |
| | manually indicate that certain pipeline-components should be considered as |
| | cache points. |
| +--> |
| <map:pipes default="caching"> |
| <map:pipe name="caching" src="org.apache.cocoon.components.pipeline.impl.CachingProcessingPipeline" |
| pool-max="${caching-pipeline.pool-max}"> |
| <!--+ |
| | Configures the size of the output buffer, i.e. the size of the output before it is |
| | (partly) send to the client. In case an error occurs during the processing of the |
| | SAX-pipeline, Cocoon is able to reset the response and send an error page instead. |
| | If the buffer size is too small the response can not be reset completely and the error |
| | page will be appended to the output already send to the client. |
| | |
| | If not specified, the value of the outputBufferSize parameter is 1048576 (1 MB). |
| | Setting it to -1 causes Cocoon to buffer all output until processing has finished |
| | before sending it to client, but might result potentially in OutOfMemoryErrors on too |
| | large outputs. |
| | |
| | For more granularity, you can also supply this parameter to |
| | individual map:pipeline elements (using map:parameter syntax). |
| +--> |
| <!-- parameter name="outputBufferSize" value="1048576"/ --> |
| </map:pipe> |
| <map:pipe name="caching-point" src="org.apache.cocoon.components.pipeline.impl.CachingPointProcessingPipeline" |
| pool-max="${caching-point-pipeline.pool-max"> |
| <!-- parameter name="autoCachingPoint" value="On"/ --> |
| <!-- parameter name="outputBufferSize" value="1048576"/ --> |
| </map:pipe> |
| <map:pipe name="noncaching" src="org.apache.cocoon.components.pipeline.impl.NonCachingProcessingPipeline" |
| pool-max="${noncaching-pipeline.pool-max}"> |
| <!-- parameter name="outputBufferSize" value="1048576"/ --> |
| </map:pipe> |
| <!--+ |
| | This pipeline implementation caches the complete content for a defined |
| | period of time (expires). The cache key is the current uri. |
| +--> |
| <map:pipe name="expires" src="org.apache.cocoon.components.pipeline.impl.ExpiresCachingProcessingPipeline" |
| pool-max="${expires-pipeline.pool-max}"> |
| <parameter name="cache-expires" value="${expires-pipeline.cache-expires}"/> <!-- Expires in secondes --> |
| <!-- parameter name="outputBufferSize" value="1048576"/ --> |
| </map:pipe> |
| </map:pipes> |
| |
| </map:components> |
| |
| |
| <!-- =========================== Views =================================== --> |
| |
| <!--+ |
| | Views provide different, well, views to resources. Views are |
| | orthogonal to pipelines. Please refer to the docs. |
| | |
| | It would be wise to disable any unneeded views in a |
| | production environment in order to avoid exposing data |
| | that you may not necessarily wish to. |
| +--> |
| <map:views> |
| <map:view from-label="content" name="content"> |
| <map:serialize type="xml"/> |
| </map:view> |
| |
| <map:view from-label="content" name="pretty-content"> |
| <map:transform src="stylesheets/system/xml2html.xslt"/> |
| <map:serialize type="html"/> |
| </map:view> |
| |
| <map:view from-position="last" name="links"> |
| <map:serialize type="links"/> |
| </map:view> |
| </map:views> |
| |
| |
| <!-- =========================== Resources ================================= --> |
| |
| <!--+ |
| | Resources are pipeline fragments that may be used from different |
| | pipeline fragments. For our needs, they behave exactly like |
| | pipelines, only that they are not accessible from outside. |
| | Hence I will explain what's inside below for pipelines. |
| +--> |
| <map:resources> |
| </map:resources> |
| |
| |
| <!-- ========================== Action sets ================================ --> |
| |
| <!--+ |
| | Action sets group actions together. If some actions are often used |
| | together in pipeline fragments, it's easier to group them and refer |
| | to the group. For more info, please see the docs. |
| +--> |
| <map:action-sets> |
| </map:action-sets> |
| |
| |
| <!-- =========================== Pipelines ================================= --> |
| |
| <!--+ |
| | Pipelines. The beef. Pipelines specify how the processing of your |
| | content is done. Usually, a pipeline consists of several fragments |
| | that specify the generation, transformation, and serialization of |
| | SAX events. |
| | |
| | Processing is done in two steps: |
| | |
| | 1) The top level elements are executed in order of appearance until |
| | one signals success. These top level elements are usually |
| | matchers. |
| | |
| | Other components are called depth-first to determine what |
| | fragments make up the processing pipeline. When a component |
| | fails, no nested components are called but the next component on |
| | the same level. |
| | |
| | 2) Once it is determined which generator, which transformers and |
| | wich serializer is used, these components are executed. During |
| | this, the pipeline may not be changed. |
| | |
| | You may have as many pipelines in your sitemap as you like. |
| +--> |
| <map:pipelines> |
| |
| <map:component-configurations> |
| <global-variables> |
| <!--+ |
| | Define global parameters here: |
| | <skin>my_skin</skin> |
| | ... |
| | You can access them by {global:*name*}, e.g. {global:skin}. |
| | These values are inherited into sub-sitemaps and can |
| | be extended there. |
| +--> |
| </global-variables> |
| </map:component-configurations> |
| |
| <!-- main pipeline --> |
| <map:pipeline> |
| |
| <!-- welcome page --> |
| <map:match pattern=""> |
| |
| <!--+ |
| | Start generating SAX events inside the pipeline. In this case, |
| | since no "type" attribute is specified, the default generator |
| | is used and this is a regular XML parser that reads the |
| | given file from the URL included in the "src" attribute and |
| | sends the events produced by the parser down the pipeline to |
| | be processed by the next stage. |
| +--> |
| <map:generate src="welcome.xml"/> |
| |
| <!--+ |
| | This transformer gets the input SAX events and transforms them |
| | using the default transformer (the XSLT transformer) thus |
| | applying the XSLT stylesheet indicated in the "src" attribute |
| | and sending the output down the pipeline to be processed by the |
| | next stage. |
| +--> |
| <map:transform src="welcome.xslt"> |
| <map:parameter name="contextPath" value="{request:contextPath}"/> |
| </map:transform> |
| |
| <!--+ |
| | The serializer concludes the SAX events journey into the pipeline |
| | since it serializes the events it receives into a representation |
| | depending on the serializer type. Here we choose the "XHMTL" |
| | serializer, which will produce an XHTML representation of the |
| | SAX stream. |
| +--> |
| <map:serialize type="xhtml"/> |
| </map:match> |
| |
| <!--+ |
| | Cocoon-provided client-side resources. |
| | Some block's jar files (e.g. Ajax & Forms) include client-side resources |
| | such as JavaScript, CSS and images. The system-level pattern below |
| | fetches these resources, while allowing them to be overridden if needed |
| | in the webapp's "resources" directory. |
| | |
| | Defining this pattern in the root sitemap avoids duplicating it in subsitemaps, |
| | which reduces copy/pasting in application code and allows better client-side |
| | caching by giving each resource a single URL. |
| | |
| | Furthermore, some Cocoon code such as the Forms-provided XSLs assume that |
| | resources are available at that URL. |
| | |
| | The absolute path for these resources is "{request:contextPath}/_cocoon/resources" |
| +--> |
| <map:match pattern="_cocoon/resources/*/**"> |
| <map:select type="resource-exists"> |
| <map:when test="resources/{1}/{2}"> |
| <map:read src="resources/{1}/{2}"/> |
| </map:when> |
| <!-- For Cocoon development, read directly from source directories |
| <map:when test="../../src/blocks/{1}/resources/org/apache/cocoon/{1}/resources/{2}"> |
| <map:read src="../../src/blocks/{1}/resources/org/apache/cocoon/{1}/resources/{2}"/> |
| </map:when> |
| --> |
| <map:otherwise> |
| <map:read src="resource://org/apache/cocoon/{1}/resources/{2}"/> |
| </map:otherwise> |
| </map:select> |
| </map:match> |
| <!-- mount Cocoon system pipelines (you may apply similar overides to those above) --> |
| <map:match pattern="_cocoon/system/*/**"> |
| <map:select type="resource-exists"> |
| <map:when test="system/{1}/sitemap.xmap"> |
| <map:mount src="system/{1}/sitemap.xmap" uri-prefix="_cocoon/system/"/> |
| </map:when> |
| <!-- For Cocoon development, read directly from source directories |
| <map:when test="../../src/blocks/{1}/resources/org/apache/cocoon/{1}/system/sitemap.xmap"> |
| <map:mount src="../../src/blocks/{1}/resources/org/apache/cocoon/{1}/system/sitemap.xmap" uri-prefix="_cocoon/system/{1}/"/> |
| </map:when> |
| --> |
| <map:otherwise> |
| <map:mount src="resource://org/apache/cocoon/{1}/system/sitemap.xmap" uri-prefix="_cocoon/system/{1}/"/> |
| </map:otherwise> |
| </map:select> |
| </map:match> |
| |
| <!--+ |
| | The default matching is also capable of matching more than a |
| | single request by the use of 'wildcards'. There are two kinds of |
| | wildcards: |
| | |
| | "*" means "anything that does not contain a path separator" |
| | "**" means "anything including path separators" |
| | |
| | The tokens matched by the wildcards are passed over as sitemap |
| | variables. Those variables can be accessed using the '{...}' syntax |
| | inside the attributes. The URI-matching tokens are associated to |
| | numbered variables, as shown in the following match that processes all |
| | the GIF images that are located in the 'images/' URL space but |
| | not in any deeper levels. Note how requesting "images/logo.gif" |
| | triggers the matcher to create the token {1} = 'logo' which is later |
| | expanded into the src="" attribute of the reader, indicating |
| | what file it has to read. |
| +--> |
| |
| <!-- images --> |
| <map:match pattern="images/*.gif"> |
| <map:read src="resources/images/{1}.gif" mime-type="image/gif"/> |
| </map:match> |
| |
| <!-- CSS stylesheets --> |
| <map:match pattern="styles/*.css"> |
| <map:read src="resources/styles/{1}.css" mime-type="text/css"/> |
| </map:match> |
| |
| <!-- JavaScript scripts --> |
| <map:match pattern="scripts/*.js"> |
| <map:read src="resources/scripts/{1}.js" mime-type="text/javascript"/> |
| </map:match> |
| |
| <!-- favicon --> |
| <map:match pattern="**favicon.ico"> |
| <map:read mime-type="image/x-icon" src="resources/icons/cocoon.ico"/> |
| </map:match> |
| |
| <!--+ |
| | mount user directories |
| | |
| | The location of user directories depends heavily on the operating |
| | system used. Uncomment the one below that suits your environment. |
| | |
| | NOTE: you might want to comment out the entire section for a |
| | production environment. |
| +--> |
| <map:match pattern="~*/**"> |
| <!-- unix --> |
| <map:mount check-reload="yes" src="/home/{1}/public_html/" uri-prefix="~{1}"/> |
| <!-- macosx --> |
| <!--map:mount check-reload="yes" src="/Users/{1}/Sites/" uri-prefix="~{1}"/--> |
| <!-- win32 --> |
| <!--map:mount check-reload="yes" src="/Documents and Settings/{1}/My Documents/My Website/" uri-prefix="~{1}"/--> |
| </map:match> |
| |
| <!--+ |
| | Redirect to the user directory if the ending slash is missing |
| | Cocoon doesn't do automatic translation of URLs because we consider it |
| | a bad practice. http://blah/something/ and http://blah/something |
| | effectively locate different web resources and the act of mapping |
| | them to the same system resources is your concern, not Cocoon's. |
| | Note that some stupid browsers (IE, for example) believe the opposite |
| | and will drop the ending slash when you bookmark a web resource |
| | so be aware of this issue and plan your URL-space carefully. |
| +--> |
| <map:match pattern="~*"> |
| <map:redirect-to uri="{0}/"/> |
| </map:match> |
| |
| <!--+ |
| | Map the API documentation. |
| +--> |
| <map:match pattern="api/**"> |
| <map:read src="api/{1}"/> |
| </map:match> |
| |
| <!--+ |
| | Find a match in the "mount-table.xml" file, if present. It allows to mount other |
| | directories without touching this main sitemap (and thus loosing changes on rebuild). |
| | |
| | Note that other mount-tables can be added here using the xpatch ant task |
| | (see src/confpatch/mount-table.xmap) |
| +--> |
| <map:match type="mount-table" pattern="../../mount-table.xml"> |
| <map:mount src="{src}" uri-prefix="{uri-prefix}"/> |
| </map:match> |
| |
| <!--+ |
| | Mount everything else by calling the sitemap.xmap file located |
| | in the requested folder. |
| +--> |
| <map:match pattern="*/**"> |
| <map:mount check-reload="${sitemap-mount.check-reload}" src="{1}/" uri-prefix="{1}"/> |
| </map:match> |
| |
| <!--+ |
| | At the very end of a pipeline, you can catch the errors triggered |
| | by the pipeline execution. The error handler is an internal sitemap |
| | component that, when triggered by an error, takes over the normal |
| | pipeline execution. |
| | You can here use the "notifying" generator that produces an XML |
| | representation and further manipulate this document for presentation |
| | on screen. |
| | You can also use any other generator if you don't want the |
| | error to be displayed on screen. The "exception" selector can help |
| | you to define different screens for different error types. |
| +--> |
| <map:handle-errors> |
| <map:select type="exception"> |
| |
| <map:when test="not-found"> |
| <map:generate type="exception"/> |
| <map:transform src="stylesheets/system/exception2html.xslt"> |
| <map:parameter name="contextPath" value="{request:contextPath}"/> |
| <map:parameter name="realPath" value="{realpath:}"/> |
| <map:parameter name="pageTitle" value="Resource not found"/> |
| </map:transform> |
| <map:serialize status-code="404"/> |
| </map:when> |
| |
| <map:when test="invalid-continuation"> |
| <map:generate type="exception"/> |
| <map:transform src="stylesheets/system/exception2html.xslt"> |
| <map:parameter name="contextPath" value="{request:contextPath}"/> |
| <map:parameter name="realPath" value="{realpath:}"/> |
| <map:parameter name="pageTitle" value="Invalid Continuation"/> |
| </map:transform> |
| <map:serialize status-code="404"/> |
| </map:when> |
| |
| <map:otherwise> |
| <map:generate type="exception"/> |
| <map:transform src="stylesheets/system/exception2html.xslt"> |
| <map:parameter name="contextPath" value="{request:contextPath}"/> |
| <map:parameter name="realPath" value="{realpath:}"/> |
| </map:transform> |
| <map:serialize status-code="500"/> |
| </map:otherwise> |
| </map:select> |
| |
| </map:handle-errors> |
| </map:pipeline> |
| </map:pipelines> |
| |
| </map:sitemap> |