home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Copyright 1999-2004 The Apache Software Foundation
-
- Licensed 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.
- -->
- <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" "document-v10.dtd">
-
- <!--
- <![CDATA[ CVS Version: $Id: host-selector.xml,v 1.7 2004/05/08 08:57:58 crossley Exp $
- ]]>
- -->
-
- <document>
- <header>
- <title>Host-Selector in Cocoon</title>
- <version>0.9</version>
- <type>Technical document</type>
- <authors>
- <person name="Bernhard Huber" email="huber@apache.org"/>
- </authors>
- <abstract>This document describes the HostSelector of Cocoon.</abstract>
- </header>
- <body>
- <s1 title="HostSelector">
- <table>
- <tr>
- <td>NAME</td><td>host</td>
- </tr>
- <tr>
- <td>WHAT</td><td>The <code>HostSelector</code> component is used to
- select appropriate sitemap processing depending on <code>Host</code> header
- value.
- </td>
- </tr>
- <tr>
- <td>TYPE</td><td>Selector, Sitemap Component</td>
- </tr>
- <tr>
- <!-- choose Core, the block name, or Scratchpad
- depending on where HostSelector sources live
- -->
- <td>BLOCK</td><td>Core</td>
- </tr>
- <tr>
- <td>CLASS</td><td>org.apache.cocoon.selection.HostSelector</td>
- </tr>
- <!-- uncomment folling tr if HostSelector is deprecated -->
- <!--tr>
- <td>DEPRECATED</td><td>Cocoon 2.0, 2.1</td>
- </tr-->
- <tr>
- <td>SINCE</td><td>Cocoon 2.0</td>
- </tr>
- <tr>
- <td>CACHEABLE</td><td>not applicable</td>
- </tr>
- </table>
- </s1>
- <s1 title="Description">
- <p>
- The <code>HostSelector</code> tests the <code>Host</code> header field from the
- request against the test attribute of the selectors when clause.
- </p>
- </s1>
- <s1 title="Usage">
- <p>
- The <code>HostSelector</code> allows to define host specific sitemap
- processing. This way Cocoon can do multi-homed sitemap processing.
- </p>
- <s2 title="Sitemap pipeline examples">
- <p>
- The snippet below uses a <code>HostSelector</code> named <code>host</code>,
- and tests against symbolic host-sites which are configured in the
- <code>host</code> selector section.
- </p>
- <source><![CDATA[
- <map:select type="host">
- <map:when test="uk-site">
- ....
- </map:when>
- <map:when test="de-site">
- ...
- </map:when>
- ...
- <map:otherwise>
- ...
- </map:otherwise>
- </map:select>
- ]]></source>
- </s2>
-
- <s2 title="Sitemap component configuration example">
- <p>
- The snippet below declares a <code>HostSelector</code>
- defining symbolic host-site names for some host domains.
- </p>
- <source><![CDATA[
- <map:selectors>
- <map:selector name="host"
- src="org.apache.cocoon.selection.HostSelector"
- logger="sitemap.selector.host"
-
- <host name="uk-site" value="foo.bar.uk"/>
- ...
- <host name="de-site" value="foo.bar.de"/>
- <host name="us-site" value="foo.bar.com"/>
-
- </map:selector>
- ...
- </map:selectors>
- ]]></source>
- </s2>
- <s2 title="Configuration">
- <p>
- <!-- Explain the sitemap selector configuration, options when declaring host selector -->
- The configuration section of <code>HostSelector</code> specifies
- a mapping from host strings to symbolic host-site names.
- </p>
- <p>
- Each host element specifies a name attribute holding the symbolic host-site name
- used in the test attribute expression. The attribute name contains
- a matchable substring of some real host header values.
- </p>
- <p>
- It is allowed to specify for a host name more than one entry. This way
- a symbolic host-site name is matched by different host header substrings.
- The snippet belows will yield true for <code>test="central-europe"</code> if
- the host header contains <code>foo.bar.cz</code>, <code>foo.bar.at</code>, or
- <code>foo.bar.hu</code>.
- </p>
- <source><![CDATA[
- ...
- <host name="central-europe" value="foo.bar.cz"/>
- <host name="central-europe" value="foo.bar.at"/>
- <host name="central-europe" value="foo.bar.uk"/>
- ...
- ]]></source>
- </s2>
- <s2 title="Setup">
- <p>
- <!-- Explain the sitemap selector setup, ie options when using host selector -->
- Setting up a <code>HostSelector</code> includes choosing the
- <code><map:when></code> test expressions and a
- optional <code><map:otherwise></code> clause.
- </p>
- <p>
- The test attribute of the <code><map:when></code> clause must match
- a host attribute name value. The value of the test attribute in a
- <code><map:when></code> clause must be declared in a
- <code>host</code> name attribute.
- </p>
- </s2>
- <s2 title="Effect on Object Model and Sitemap Parameters">
- <p>
- The <code>HostSelector</code> has no side effects on the object model or
- any sitemap parameters.
- </p>
- </s2>
- </s1>
- <s1 title="Bugs/Caveats">
- <p>
- The <code>HostSelector</code> adds the response header attribute
- <code>Vary</code> having value <code>Host</code> indicating
- that the response differ for different hosts. This information
- is particularly meaningful for a http-proxy server.
- </p>
- </s1>
- <s1 title="History">
- <p>
- 28-12-02: initial creation
- </p>
- </s1>
- <s1 title="See also">
- <p>
- <!-- Links to related components pages. -->
- A general documentation about selectors is available at
- <link href="../concepts/matchers_selectors.html">Matchers and Selectors</link>.
- </p>
- <p>
- For a detailed <code>Host</code> header documentation
- see <link href="http://www.ietf.org/rfc/rfc2068.txt">RFC 2068</link>, especially
- if Cocoon's run time environment is an http servlet environment.
- </p>
- </s1>
- </body>
- </document>
-
-