cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeroen Cranendonk <j.cranend...@emaxx.nl>
Subject Re: Parameter matcher
Date Thu, 24 Apr 2003 11:18:47 GMT
This is what I've used for something, might do what you want :)
might be obfescated too, if so someone please tell me ;)

         <map:matcher logger="sitemap.matcher.regexp-page" name="regexp-page" 
src="org.apache.cocoon.matching.RegexpParameterMatcher">
            <parameter-name>page</parameter-name>           <!-- match agains

this parameter -->
         </map:matcher>

        <map:match type="regexp-page" pattern="\.xsp$">
                  <map:parameter name="page" value="{page}"/>  <!-- mathcher 
matches agains parameters you give the matcher, not global sitemap params I 
think so I pass the global one to the matcher  -->
                   <map:generate type="serverpages" src="{../page}"/>
<!-- why is this ../ thing needed anyways ? :) -->
               </map:match>

Hope that helps :)

On Thursday 24 April 2003 11:06, Carmona Perez, David wrote:
> Maybe, I haven't selected the right type of matcher.  Does anyone know how
> I can branch on the value of a sitemap variable?
>
> ------
> David
>
> -----Mensaje original-----
> De: Carmona Perez, David
> Enviado el: jueves, 24 de abril de 2003 10:17
> Para: cocoon-users@xml.apache.org
> Asunto: Parameter matcher
>
> Hi all,
>
> I have an action that can set a sitemap parameter whose name is "redirect",
> and when it is set the pipeline processing must branch to some other place.
>
> Have this sitemap:
>
> <map:matchers default="wildcard">
>         <map:matcher logger="sitemap.matcher.wildcard" name="wildcard"
>                 src="org.apache.cocoon.matching.WildcardURIMatcher"/>
>         <map:matcher logger="sitemap.matcher.regexp" name="regexp"
>                 src="org.apache.cocoon.matching.RegexpURIMatcher"/>
>         <map:matcher logger="sitemap.matcher.regexp" name="parameter"
>                 src="org.apache.cocoon.matching.ParameterMatcher"/>
> </map:matchers>
>
> <map:pipeline>
>         <map:act name="myAction">
>                 <map:match type="parameter" pattern="redirect">
>                 <map:redirect-to uri="{1}"/>
>                 </map:match>
>                 ....
>         </map:act>
> </map:pipeline>
>
>
> And the matcher "parameter" always fails because it receives always an
> empty parameters.
>
> public Map match(String pattern, Map objectModel, Parameters parameters) {
> }
>
> The compiled sitemap, for the matcher call has something like this:
>
>       if ((map = matches("parameter", matcher_N400121_expr, "redirect",
> Parameters.EMPTY_PARAMETERS, objectModel)) != null) {
>                 environment.redirect (false, substitute(listOfMaps, "{1}",
> environment)); }
>
> Any help will be greatly appreciated!
>
> ------
> David
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Mime
View raw message