You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Yvan Peter <Yv...@univ-lille1.fr> on 2002/09/12 14:58:50 UTC

Re: putting a request param in session and using it in the sitemap [SOLUTION]

   Thanks to the people who answered, it helped me building a solution.

   Here is the sitemap snippet that put a request param into a session 
and can latter retrieve it in the sitemap :

   <map:match pattern="test/*">
     <map:match type="request-parameter" pattern="device">
       <!-- if URL of type localhost/test?device="Wap" put the value of
            the parameter in session -->
       <map:act type="session-propagator">
         <map:parameter name="device" value="{1}" />
       </map:act>
       <!-- then redirect to the pipeline that does the work -->
       <map:redirect-to uri="cocoon:/good-test/{../1}" />
     </map:match>
     <map:match type="session-attribute" pattern="device">
       <!-- else find the device value in session and use it for
            redirection -->
       <map:redirect-to uri="cocoon:/good-test/{../1}?device={1}" />
     </map:match>
   </map:match>

   <map:match pattern="good-test/*">
     <map:generate src="test/{1}.xml" />
     <map:select type="request-parameter">
       <map:parameter name="parameter-name" value="device" />
       <map:when test="Wap">
         <map:transform src="test/XML2WML.xsl" />
       </map:when>
       <map:when test="Voix">
           <map:transform src="test/XML2VXML.xsl" />
       </map:when>
       <map:otherwise>
         <map:transform src="test/XML2HTML.xsl" />
       </map:otherwise>
     </map:select>
     <map:serialize />
   </map:match>

>>
>>    Hello,
>>
>>    Here is the behavior i would like to achieve in the sitemap :
>>
>>    A first access will be with an URL of that pattern :
>>      http://localhost/login?device={Voice, WAP or Web}
>>
>>    Then the device parameter is not given anymore and of course, i need
>> to remember it to choose the appropriate XSL...
>>
>>    I did not find how to put a request parameter in a session and get 
>> it back latter from that session for use in the sitemap.



-- 
------------------------------------------------------------------
| Yvan Peter                    | phone (33) 3.20.43.32.64       |
| CUEEP/Laboratoire TRIGONE     | fax   (33) 3.20.43.32.79       |
| Bat. B6                       | mail Yvan.Peter@univ-lille1.fr |
| Cite Scientifique             |                                |
| 59655 Villeneuve d'Ascq Cedex |                                |
------------------------------------------------------------------


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>