org.apache.cocoon.matching
Class MountTableMatcher
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.matching.MountTableMatcher
- All Implemented Interfaces:
- Component, LogEnabled, Parameterizable, Serviceable, ThreadSafe, Matcher
public class MountTableMatcher
- extends AbstractLogEnabled
- implements Matcher, ThreadSafe, Serviceable, Parameterizable
A matcher that manages a "mount table", allowing to add subsitemaps to a Cocoon application without
modifying the main sitemap. This is especially useful for prototypes and demos where installing
a separate instance of Cocoon is overkill.
The mount table is an xml file which has a format similar to the map:mount
syntax:
<mount-table>
<mount uri-prefix="foo" src="file://path/to/foo/directory/"/>
<mount uri-prefix="bar/baz" src="file://path/to/bar-baz/directory/"/>
</mount-table>
The matcher will scan the mount table for an "uri-prefix" value matching the beginning of the current
request URI, and if found, succeed and populate the "src" and "uri-prefix" sitemap variables.
Usage in the sitemap is therefore as follows:
<map:match type="mount-table" pattern="path/to/mount-table.xml">
<map:mount uri-prefix="{uri-prefix}" src="{src}"/>
</map:match>
This matcher accepts a single configuration parameter, indicating if missing mount tables should be
silently ignored (defaults is false
, meaning "don't ignore"):
<map:matcher type="mount-table" src="org.apache.cocoon.matching.MountTableMatcher">
<map:parameter name="ignore-missing-tables" value="true"/>
</map:matcher>
This configuration is used in the main sitemap of Cocoon samples, to allow users to define their own mount
table, but not fail if it does not exist.
- Version:
- $Id: MountTableMatcher.html 1304258 2012-03-23 10:09:27Z ilgrosso $
- Author:
- Sylvain Wallez
Fields inherited from interface org.apache.cocoon.matching.Matcher |
ROLE |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MountTableMatcher
public MountTableMatcher()
service
public void service(ServiceManager manager)
throws ServiceException
- Specified by:
service
in interface Serviceable
- Throws:
ServiceException
parameterize
public void parameterize(Parameters params)
throws ParameterException
- Specified by:
parameterize
in interface Parameterizable
- Throws:
ParameterException
match
public Map match(String pattern,
Map objectModel,
Parameters parameters)
throws PatternException
- Description copied from interface:
Matcher
- Matches the pattern against some
Request
values
and returns a Map
object with replacements
for wildcards contained in the pattern.
- Specified by:
match
in interface Matcher
- Parameters:
pattern
- The pattern to match against. Depending on the
implementation the pattern can contain wildcards
or regular expressions.objectModel
- The Map
with object of the
calling environment which can be used
to select values this matchers matches against.
- Returns:
- Map The returned
Map
object with
replacements for wildcards/regular-expressions
contained in the pattern.
If the return value is null there was no match.
- Throws:
PatternException
Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.