org.apache.cocoon.selection
Class HostSelector

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.selection.NamedPatternsSelector
          extended by org.apache.cocoon.selection.HostSelector
All Implemented Interfaces:
Component, Configurable, LogEnabled, ThreadSafe, Selector

public class HostSelector
extends NamedPatternsSelector

A Selector that matches a string from within the host parameter of the HTTP request.

Configuration:

 <map:selector name="host" src="org.apache.cocoon.selection.HostSelector">
   <host name="uk-site" value="www.foo.co.uk"/>
 </map:selector>
 

Usage:

 <map:select type="host">
   <map:when test="uk-site">
     <map:transform src="stylesheets/page/uk.xsl"/>
   </map:when>
   <map:otherwise>
     <map:transform src="stylesheets/page/us.xsl"/>
   </map:otherwise>
 </map:select>
 

Version:
CVS $Id: HostSelector.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Colin Britton, Sylvain Wallez

Field Summary
 
Fields inherited from interface org.apache.cocoon.selection.Selector
ROLE
 
Constructor Summary
HostSelector()
           
 
Method Summary
 void configure(Configuration conf)
           
 boolean select(String expression, Map objectModel, Parameters parameters)
          Selectors test pattern against some objects in a Map model and signals success with the returned boolean value
 
Methods inherited from class org.apache.cocoon.selection.NamedPatternsSelector
checkPatterns, checkPatterns, configure
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HostSelector

public HostSelector()
Method Detail

configure

public void configure(Configuration conf)
               throws ConfigurationException
Throws:
ConfigurationException

select

public boolean select(String expression,
                      Map objectModel,
                      Parameters parameters)
Description copied from interface: Selector
Selectors test pattern against some objects in a Map model and signals success with the returned boolean value

Parameters:
expression - The expression to test.
objectModel - The Map containing object of the calling environment which may be used to select values to test the expression.
parameters - The sitemap parameters, as specified by <parameter/> tags.
Returns:
boolean Signals successfull test.


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.