You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by David Swearingen <ga...@yahoo.com> on 2004/07/28 16:05:41 UTC

Processing a particular pipeline before every other pipeline?

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?
 
 

Re: Processing a particular pipeline before every other pipeline?

Posted by Upayavira <uv...@upaya.co.uk>.
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?
>  

Let me be terse for the moment. I'd suggest you use 
cocoon.processPipelineTo() from within flowscript. Then, 
cocoon.sendPage() will run the actual presentation pipeline.

Regards, Upayavira



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


Re: Processing a particular pipeline before every other pipeline?

Posted by Jan Hoskens <jh...@schaubroeck.be>.
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


Re: Processing a particular pipeline before every other pipeline?

Posted by Gunter D'Hondt <gu...@sofico.be>.
Start your <map:pipeline> with a <map:act ...> then the action will be 
executed before all matchers below (listed in that map:pipeline)

Regards,
Gunter D'Hondt
SOFICO NV Belgium.






David Swearingen <ga...@yahoo.com> 
28/07/2004 16:05
Please respond to
users@cocoon.apache.org


To
users@cocoon.apache.org
cc

Subject
Processing a particular pipeline before every other pipeline?






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?