You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Ugo Cei <u....@cbim.it> on 2001/07/17 16:43:33 UTC

[C2] Session validator deletes {1}

It looks like there is a bug in SessionValidatorAction. Suppose you have 
a sitemap entry like this one:

<map:match pattern="*.html">
   <map:act type="session-validator">
     <map:parameter name="descriptor" context://descriptors/params.xml"/>
     <map:parameter name="validate" value="username"/>
     <map:generate type="serverpages" src="docs/{1}.xsp"/>
     <map:transform src="stylesheets/simple-page2html.xsl"/>
     <map:serialize/>
   </map:act>
   <map:redirect-to uri="login.html"/>
</map:match>

This fails because the XSP generator cannot find "docs/null.xsp". 
Apparently the SessionValidatorAction deletes any exixting sitemap 
parameter before copying the session attributes to the sitemap, so the 
value of {1} is lost.

Can anyone confirm this?

	Ugo


-- 
Ugo Cei - Consorzio di Bioingegneria e Informatica Medica
P.le Volontari del Sangue, 2 - 27100 Pavia - Italy
Phone: +39.0382.525100 - E-mail: u.cei@cbim.it


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


Re: [C2] Session validator deletes {1}

Posted by Ugo Cei <u....@cbim.it>.
Berin Loritsch wrote:

 
> Please note that {1} is changed to {../1}.  This is due to the fact that matchers
> and Actions can nest inside each other, and return values that can be acted upon
> in the sitemap.

Beautiful! It works perfectly now, thank you.

-- 
Ugo Cei - Consorzio di Bioingegneria e Informatica Medica
P.le Volontari del Sangue, 2 - 27100 Pavia - Italy
Phone: +39.0382.525100 - E-mail: u.cei@cbim.it


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


Re: [C2] Session validator deletes {1}

Posted by Berin Loritsch <bl...@apache.org>.
Ugo Cei wrote:
> 
> It looks like there is a bug in SessionValidatorAction. Suppose you have
> a sitemap entry like this one:
> 
> <map:match pattern="*.html">
>    <map:act type="session-validator">
>      <map:parameter name="descriptor" context://descriptors/params.xml"/>
>      <map:parameter name="validate" value="username"/>
>      <map:generate type="serverpages" src="docs/{1}.xsp"/>
>      <map:transform src="stylesheets/simple-page2html.xsl"/>
>      <map:serialize/>
>    </map:act>
>    <map:redirect-to uri="login.html"/>
> </map:match>

In this case, you get to experience the heirarchy of matchers.  Try the following:

<map:match pattern="*.html">
   <map:act type="session-validator">
     <map:parameter name="descriptor" context://descriptors/params.xml"/>
     <map:parameter name="validate" value="username"/>
     <map:generate type="serverpages" src="docs/{../1}.xsp"/>
     <map:transform src="stylesheets/simple-page2html.xsl"/>
     <map:serialize/>
   </map:act>
   <map:redirect-to uri="login.html"/>
</map:match>

Please note that {1} is changed to {../1}.  This is due to the fact that matchers
and Actions can nest inside each other, and return values that can be acted upon
in the sitemap.

Concider the following example:

<map:match pattern="**.html">
  <map:match pattern="inbox/**.html">
    <map:generator type="serverpages" src="{1}.xsp"/>
  </map:match>
</map:match>

What does {1} match?  The way it is defined in the sitemap, is that there is
a heirarchy.  If we wanted to match the original wildcard, you would have to
reference it like this: {../1}.  If you want to match the internal wildcard,
you already have it specified correctly.

> 
> This fails because the XSP generator cannot find "docs/null.xsp".
> Apparently the SessionValidatorAction deletes any exixting sitemap
> parameter before copying the session attributes to the sitemap, so the
> value of {1} is lost.
> 
> Can anyone confirm this?
> 
>         Ugo
> 
> --
> Ugo Cei - Consorzio di Bioingegneria e Informatica Medica
> P.le Volontari del Sangue, 2 - 27100 Pavia - Italy
> Phone: +39.0382.525100 - E-mail: u.cei@cbim.it
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org

Re: [C2] Session validator deletes {1}

Posted by giacomo <gi...@apache.org>.
On Tue, 17 Jul 2001, Ugo Cei wrote:

> It looks like there is a bug in SessionValidatorAction. Suppose you have
> a sitemap entry like this one:
>
> <map:match pattern="*.html">
>    <map:act type="session-validator">
>      <map:parameter name="descriptor" context://descriptors/params.xml"/>
>      <map:parameter name="validate" value="username"/>
>      <map:generate type="serverpages" src="docs/{1}.xsp"/>
>      <map:transform src="stylesheets/simple-page2html.xsl"/>
>      <map:serialize/>
>    </map:act>
>    <map:redirect-to uri="login.html"/>
> </map:match>
>
> This fails because the XSP generator cannot find "docs/null.xsp".
> Apparently the SessionValidatorAction deletes any exixting sitemap
> parameter before copying the session attributes to the sitemap, so the
> value of {1} is lost.

Your sitemap is wrong (not the system). You have the following stack of
Maps. On top is the one from the Matcher and next comes the one from the
Action. Thus your reference to the matchers value should be {../1}

Giacomo


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