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 / browser-selector.xml < prev    next >
Encoding:
Extensible Markup Language  |  2004-07-12  |  6.0 KB  |  187 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: browser-selector.xml,v 1.6 2004/05/08 08:57:58 crossley Exp $ 
  21.   ]]>
  22. -->
  23.  
  24. <document>
  25.   <header>
  26.     <title>Browser-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 BrowserSelector of Cocoon.</abstract>
  33.   </header>
  34.   <body>
  35.     <s1 title="BrowserSelector">
  36.       <table>
  37.         <tr>
  38.           <td>NAME</td><td>browser</td>
  39.         </tr>
  40.         <tr>
  41.           <td>WHAT</td><td>The <code>BrowserSelector</code> component is used to
  42.             select appropriate sitemap processing depending on the <code>User-Agent</code>
  43.             header 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 BrowserSelector sources live
  52.           -->
  53.           <td>BLOCK</td><td>Core</td>
  54.         </tr>
  55.         <tr>
  56.           <td>CLASS</td><td>org.apache.cocoon.selection.BrowserSelector</td>
  57.         </tr>
  58.         <!-- uncomment folling tr iff BrowserSelector 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>BrowserSelector</code> tests the user agent header field against
  73.         the test attribute of the selectors when clause.
  74.       </p>
  75.     </s1>
  76.     <s1 title="Usage">
  77.       <p>
  78.         The <code>BrowserSelector</code> allows to define brower specific sitemap
  79.         processing.
  80.       </p>
  81.       <s2 title="Sitemap pipeline examples">
  82.         <p></p>
  83.         <source><![CDATA[
  84. <map:select type="browser">
  85.   <map:when test="netscape">
  86.   ....
  87.   </map:when>
  88.   <map:when test="explorer">
  89.   ...
  90.   </map:when>
  91.   ...
  92.   <map:otherwise>
  93.   ...
  94.   </map:otherwise>
  95. </map:select>
  96.         ]]></source>
  97.       </s2>
  98.       
  99.       <s2 title="Sitemap component configuration example">
  100.         <p>
  101.         </p>
  102.         <source><![CDATA[
  103. <map:selectors...
  104.   <map:selector name="browser" 
  105.     src="org.apache.cocoon.selection.BrowserSelector"
  106.     logger="sitemap.selector.browser" 
  107.     
  108.     <browser name="explorer" useragent="MSIE"/>
  109.     ...
  110.     <browser name="mozilla5" useragent="Moziall/5"/>
  111.     <browser name="netscape" useragent="Mozilla"/>
  112.     
  113.   </map:selectors>
  114. ...
  115. ]]></source>
  116.       </s2>
  117.       <s2 title="Configuration">
  118.         <p>
  119.           <!-- Explain the sitemap selector configuration, options when declaring browser selector -->
  120.           The configuration section of <code>BrowserSelector</code> specifies
  121.           a mapping from user-agent strings to symbolic browser names.
  122.         </p>
  123.         <p>
  124.           Each browser element specifies a name attribute holding the symbolic browser name
  125.           used in the test attribute expression. The attribute useragent contains 
  126.           a matchable substring of some real user-agent values.
  127.         </p>
  128.         <p>
  129.           It is allowed to specify for a browser name more than one entry. This way
  130.           a symbolic browser name is matched by different user-agent substrings.
  131.           The snippet belows will yield true for <code>test="wap-handset"</code> if 
  132.           the user-agent header contains <code>Nokia</code>, <code>UP</code>, or 
  133.           <code>Wapalizer</code>.
  134.         </p>
  135.         <source><![CDATA[
  136. ...
  137.   <browser name="wap-handset" useragent="Nokia"/>
  138.   <browser name="wap-handset" useragent="UP"/>
  139.   <browser name="wap-handset" useragent="Wapalizer"/>
  140. ...
  141.         ]]></source>
  142.       </s2>
  143.       <s2 title="Setup">
  144.         <p>
  145.           <!-- Explain the sitemap selector setup, ie options when using browser selector -->
  146.           Setting up a <code>BrowserSelector</code> includes choosing the 
  147.           <code><map:when></code> test expressions, and a 
  148.          optional <code><map:otherwise></code> clause.
  149.         </p>
  150.         <p>
  151.           The test attribute of the <code><map:when></code> clause must match
  152.           a browser attribute name value. The value of the test attribute in a 
  153.           <code><map:when></code> clause must be declared in a 
  154.           <code>browser</code> name attribute.
  155.         </p>
  156.       </s2>
  157.       <s2 title="Effect on Object Model and Sitemap Parameters">
  158.         <p>
  159.           The <code>BrowserSelector</code> has no side effects on the object model, or 
  160.           any sitemap parameters. 
  161.         </p>
  162.       </s2>
  163.     </s1>
  164.     <s1 title="Bugs/Caveats">
  165.       <p>
  166.         The <code>BrowserSelector</code> adds the response header attribute
  167.         <code>Vary</code> having value <code>User-Agent</code> indicating
  168.         that the response differ for different user agents. This information
  169.         especially meaningfull for an http-proxy server.
  170.       </p>
  171.     </s1>
  172.     <s1 title="History">
  173.       <p>
  174.         28-12-02: initial creation
  175.       </p>
  176.     </s1>
  177.     <s1 title="See also">
  178.       <p>
  179.         <!-- Links to related components pages. -->
  180.         A general documentation about selectors is available at
  181.         <link href="../concepts/matchers_selectors.html">Matchers and Selectors</link>.
  182.       </p>
  183.     </s1>
  184.   </body>
  185. </document>
  186.  
  187.