Matchers are used to match the request into a particular pipeline. In Paloose (version 0.7.0 or later) there are two types of matcher: WildcardURIMatcher and RegexpURIMatcher. WildcardURIMatcher is equivalent to the Cocoon matcher of the same name. However RegexpURIMatcher is slightly different to its Cocoon equivalent: it uses a PHP-modified Perl regular expression syntax. For details of this see the PHP manual pages)
The default attribute specifies the type of matcher to use if none is specified in a pipeline.
It is possible to define variables in the Cocoon sitemap. Paloose uses this principle, but, at present, uses a very restricted set. Like Cocoon variables are defined by enclosing them in brackets "{...}". The primary area where this is used is in the pattern matching.
For example take the wildcard matcher
The wildcards in the match pattern are assigned to internal pattern variables "{1}", "{2}" etc, in a similar fashion to Perl regular expressions. So in the above case if the pattern to be matched is "documentation/index.html" then there would be a match. The internal variables would be set {1} = "documentation" and {2} = "index". These variables are used within the various pipeline components to resolve string expressions. For example
In this case the generator would fetch the file documentation/index.xml from the current application context (see pseudo protocols below). Note that the constructions "**" and "*" are different and are identical to their Cocoon counterparts.
The values for the pattern variables are taken from the current matcher. If you want to access a higher matcher (wherever it is) then you would have to use the string {../1}, which means access the pattern variable {1} in the previous matcher. These can be extended as necessary, for example {../../1} to access a matcher two levels above the current one.
Since version 0.7.0 it has been possible to carry out matching using regular expressions. Paloose regular expressions are not the same as Cocoon regular expressions. The PHP5 version based on Perl is used and a full description of the regexp can be found on the PHP5 manual page. The pattern variables work in similar fashion as the wildcard matcher. For example:
would match all requests that have a file extension "html", "tex" and "xml". In the following all requests for documents between "nb1996" and "nb1999" would read the html file directly:
and the following would take all others in 2000 or later and process them from an XML file.