cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Hoskens ...@schaubroeck.be>
Subject Re: Processing a particular pipeline before every other pipeline?
Date Wed, 28 Jul 2004 14:27:36 GMT
Use the internal-only attribute:

<map:pipelines>
    <map:pipeline internal-only="true" >
       put every pipeline you don't want the user to access directly here
    </map:pipeline>

    <map:pipeline>
        <map:match pattern="**">
             do whatever you need as actions that's needed for each 
internal pipeline
             <map:redirect-to src="cocoon:/{1}"/>
        </map:match>
    </map:pipeline>
</map:pipelines>

The redirect-to doesn't do a http redirect if you use the cocoon:/ 
protocol (see 
http://cocoon.apache.org/2.1/userdocs/concepts/redirection.html)
So every external request ends up in the second pipeline while the 
internal redirect sees the first pipeline and doesn't reach the second 
one if the first pipeline covers everything. Mind this last phrase! If 
you don't want to be cycling through your sitemap pipelines until a 
redirect exceeded error pops up! You can create a matcher at the end of 
the first line with pattern="**" that tries to read default xml pages 
like this:

<map:match pattern="**">
    <map:generate src="pages/{1}"/>
    <map:serialize/>
</map:match>

This avoids the cycle and when not found, your error handler will come in.

Kind Regards,
Jan


David Swearingen wrote:

> I need to run some cookie generation code (in a pipeline) before any 
> of my web pages are processed.  That is, I've got several pipelines, 
> but I want this particular pipeline to run before any of the others 
> are executed.  Obviously, I don't want to have to modify every 
> existing pipeline, and all subsequent new pipelines.  I imagine that 
> this code will be an Action or XSP, but that's really besides the 
> point: this is more of a pipeline question as I see it.
>  
> (I knew how to do this in Struts, but haven't seen anything like this 
> so far in my first few months of using Cocoon.  In web applications 
> I've written this type of thing is normally needed for authentication  
> -- e.g. make sure every request goes through the authentication 
> servlet before it hits any other servlet...) 
>  
> Does anyone know how to do this?
>  
>  



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


Mime
View raw message