home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-cocoon-addon-1.4.9-installer.exe / requestattribute-selector.xml < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  5.7 KB  |  173 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.   Copyright 1999-2004 The Apache Software Foundation
  4.  
  5.   Licensed under the Apache License, Version 2.0 (the "License");
  6.   you may not use this file except in compliance with the License.
  7.   You may obtain a copy of the License at
  8.  
  9.       http://www.apache.org/licenses/LICENSE-2.0
  10.  
  11.   Unless required by applicable law or agreed to in writing, software
  12.   distributed under the License is distributed on an "AS IS" BASIS,
  13.   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.   See the License for the specific language governing permissions and
  15.   limitations under the License.
  16. -->
  17. <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "document-v10.dtd">
  18.  
  19. <!--
  20.   <![CDATA[ CVS Version: $Id: requestattribute-selector.xml,v 1.7 2004/05/08 08:57:58 crossley Exp $ 
  21.   ]]>
  22. -->
  23.  
  24. <document>
  25.   <header>
  26.     <title>RequestAttribute-Selector in Cocoon</title>
  27.     <version>0.9</version>
  28.     <type>Technical document</type>
  29.     <authors>
  30.       <person name="Bernhard Huber" email="huber@apache.org"/>
  31.     </authors>
  32.     <abstract>This document describes the RequestAttributeSelector of Cocoon.</abstract>
  33.   </header>
  34.   <body>
  35.     <s1 title="RequestAttributeSelector">
  36.       <table>
  37.         <tr>
  38.           <td>NAME</td><td>request-attribute</td>
  39.         </tr>
  40.         <tr>
  41.           <td>WHAT</td><td>The <code>RequestAttributeSelector</code> component is used to
  42.             select appropriate sitemap processing depending on a request attribute
  43.             value.
  44.           </td>
  45.         </tr>
  46.         <tr>
  47.           <td>TYPE</td><td>Selector, Sitemap Component</td>
  48.         </tr>
  49.         <tr>
  50.           <!-- choose Core, the block name, or Scratchpad 
  51.             depending on where RequestAttributeSelector sources live
  52.           -->
  53.           <td>BLOCK</td><td>Core</td>
  54.         </tr>
  55.         <tr>
  56.           <td>CLASS</td><td>org.apache.cocoon.selection.RequestAttributeSelector</td>
  57.         </tr>
  58.         <!-- uncomment folling tr iff RequestAttributeSelector is deprecated -->
  59.         <!--tr>
  60.           <td>DEPRECATED</td><td>Cocoon 2.0, 2.1</td>
  61.         </tr-->
  62.         <tr>
  63.           <td>SINCE</td><td>Cocoon 2.0</td>
  64.         </tr>
  65.         <tr>
  66.           <td>CACHEABLE</td><td>not applicable</td>
  67.         </tr>
  68.       </table>
  69.     </s1>
  70.     <s1 title="Description">
  71.       <p>
  72.         The <code>RequestAttributeSelector</code> tests the value of request attribute
  73.         against the test attribute of the selector's when clause.
  74.       </p>
  75.     </s1>
  76.     <s1 title="Usage">
  77.       <p>
  78.         The <code>RequestAttributeSelector</code> allows to control the 
  79.         sitemap processing depending on a request attribute.
  80.       </p>
  81.       <s2 title="Sitemap pipeline examples">
  82.         <p>
  83.           The snippet below uses a <code>RequestAttributeSelector</code> named <code>request-attribute</code>.
  84.           It tests the value of request attribute named <code>command</code> against
  85.           <code>list</code>, <code>create</code>; finally it has a <code>otherwise</code> clause.
  86.         </p>
  87.         <source><![CDATA[
  88. <map:select type="request-attribute">
  89.   <map:parameter name="attribute-name" value="command"/>
  90.   <map:when test="list">
  91.   ....
  92.   </map:when>
  93.   <map:when test="create">
  94.   ...
  95.   </map:when>
  96.   ...
  97.   <map:otherwise>
  98.   ...
  99.   </map:otherwise>
  100. </map:select>
  101.         ]]></source>
  102.       </s2>
  103.       
  104.       <s2 title="Sitemap component configuration example">
  105.         <p>
  106.           The snippet below declares a <code>RequestAttributeSelector</code>
  107.           defining to use the request attribute <code>cmd</code>.
  108.         </p>
  109.         <source><![CDATA[
  110. <map:selectors...
  111.   <map:selector name="request-attribute" 
  112.     src="org.apache.cocoon.selection.RequestAttributeSelector"
  113.     logger="sitemap.selector.requestattribute">
  114.     
  115.     <attribute-name>command</attribute-name>
  116.   </map:selectors>
  117. ...
  118. ]]></source>
  119.       </s2>
  120.       <s2 title="Configuration">
  121.         <p>
  122.           <!-- Explain the sitemap selector configuration, options when declaring request-attribute selector -->
  123.           The configuration section of <code>RequestAttributeSelector</code> specifies
  124.           the default name of the request attribute, used for testing.
  125.         </p>
  126.       </s2>
  127.       <s2 title="Setup">
  128.         <p>
  129.           <!-- Explain the sitemap selector setup, ie options when using request-attribute selector -->
  130.           Setting up a <code>RequestAttributeSelector</code> includes
  131.         </p>
  132.         <ul>
  133.           <li>Defining an optional sitemap paramter named <code>request-name</code>, it overrides
  134.             the attribute-name setting in the configuration section.
  135.           </li>
  136.           <li>choosing the <code><map:when></code> test expressions, and a 
  137.           optional <code><map:otherwise></code> clause.
  138.           </li>
  139.         </ul>
  140.         <p>
  141.           The test attribute of the <code><map:when></code> clause shall match
  142.           the value of the request attribute.
  143.           If no test value matches, or the request attribute is not defined at all,
  144.           the <code><map:otherwise</code> clause is selected.
  145.         </p>
  146.       </s2>
  147.       <s2 title="Effect on Object Model and Sitemap Parameters">
  148.         <p>
  149.           The <code>RequestAttributeSelector</code> has no side effects on the object model, or 
  150.           any sitemap attributes. 
  151.         </p>
  152.       </s2>
  153.     </s1>
  154.     <s1 title="Bugs/Caveats">
  155.       <p>
  156.       </p>
  157.     </s1>
  158.     <s1 title="History">
  159.       <p>
  160.         28-12-02: initial creation
  161.       </p>
  162.     </s1>
  163.     <s1 title="See also">
  164.       <p>
  165.         <!-- Links to related components pages. -->
  166.         A general documentation about selectors is available at
  167.         <link href="../concepts/matchers_selectors.html">Matchers and Selectors</link>.
  168.       </p>
  169.     </s1>
  170.   </body>
  171. </document>
  172.  
  173.