cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Graaf, Edgar de (fin)" <Edgar.de.Gr...@ordina.nl>
Subject RE: how do I redirect in an Action?
Date Mon, 27 May 2002 09:04:06 GMT
It totally depends on what you want to replace with your resource...

if you have the pipeline like:
==============================
<map:pipeline>
	...
	...
	<map:match pattern="page1.html">
		<map:generate src="page1.xml"/>
		<map:transform src="pageTohtml.xsl"/>
		<map:serialize type="html"/>

You can change this to the following:
=====================================
<map:resources>
<map:resource name="standard">
	<map:transform src="pageTohtml.xsl"/>
	<map:serialize type="html"/>
</map:resource>
</map:resources>

<map:pipelines>
....
<map:pipeline>
	...
	...
	<map:match pattern="page1.html">
		<map:generate src="page1.xml"/>
		<map:call resource="standard"/>
	</map:match>
	...
</map:pipeline>
..
</map:pipelines>


The advantage is that if you change the stylesheet pageTohtml.xsl you only
have to change it in one place.


-----Oorspronkelijk bericht-----
Van: Christopher Painter-Wakefield [mailto:paint007@mc.duke.edu]
Verzonden: donderdag 23 mei 2002 17:39
Aan: cocoon-users@xml.apache.org
Onderwerp: RE: how do I redirect in an Action?



Thanks for all the suggestions.  I'm pretty confused at this point, as I
haven't used <map:resource> or <map:select> previously, so I need to spend
some time understanding the code you've offered.  One thing in particular I
don't see is where I should put my normal generate, transform, and
serialize steps for the protected URL.  Do they just go after the call to
the resource?

-Christopher



Hi Christopher and Edgar,

Couple things.  I could be wrong, but I believe in Edgar's example, the
redirect would always execute (since it sits outside the action).

Also, depending on how many protected url matchers you have, you can also
delegate all work to a resource where you could put all your authentication
and redirect logic (so you don't have to have it in each matcher).  So you
could do something like this:

 <map:match pattern="some protected url">
  <map:call resource="authenticatedAccess">
   <map:parameter name="someIDForThisPipe"
value="foo"/>
   ... any other params you might need to process this
pipe ...
  </map:call>
 </map:match>

 <map:match pattern="some other protected url">
  <map:call resource="authenticatedAccess">
   <map:parameter name="someIDForThisPipe"
value="bar"/>
   ... any other params you might need to process this
pipe ...
  </map:call>
 </map:match>

And the resource might look like:

 <map:resource name="authenticatedAccess">
  <map:act type="my-authenticator">
   <map:select type="parameter">
    <map:parameter
name="parameter-selector-test" value="{authStatus}"/>
    <map:when test="success">
     ... stuff to process pipeline based
on params
    </map:when>
    <map:otherwise>
     <map:redirect-to
uri="loginpage.html"/>
    </map:otherwise>
   </map:select>
  </map:act>
 </map:resource>


Anyway, hope that helps!

Harry




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

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

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

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