You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by ap...@vipsurf.de on 2000/01/02 09:55:34 UTC
Handling Preconditions
Hi,
I'm missing a framework for handling preconditions in Cocoon. In my applications, I usually have to validate a user against a database and check for pages he/she has already visited. This could be easiliy achieved via preconditions: Before actually calling the Engine (or as the first action of the engine itself), I'd call something like
while(true) {
Precondition pre = preconditions.getCondition(document);
if(!pre.accomplished())
doSomething();
}
In my special environment, I'd check for a valid DB-Connection ID and, if I don't find one, redirect the user to a longin-page.
This would also allow to handover "global" data (e.g. Connections) to the processors via the parameter-map and would therefore eliminate the need to code this in the document itself (see how SQLProcessor deals with connection - and with the potential security hazards associated with this method)
Talking about the Sitemap Proposal:
Don't forget to add XCatalog-Support to your configuration file. This would dramatically reduce customization efforts.
Armin Pfarr
Email: apfarr@vipsurf.de
Re: Handling Preconditions
Posted by Stefano Mazzocchi <st...@apache.org>.
apfarr@vipsurf.de wrote:
>
> Hi,
>
> I'm missing a framework for handling preconditions in Cocoon. In my applications, I usually have to validate a user against a database and check for pages he/she has already visited. This could be easiliy achieved via preconditions: Before actually calling the Engine (or as the first action of the engine itself), I'd call something like
>
> while(true) {
> Precondition pre = preconditions.getCondition(document);
> if(!pre.accomplished())
> doSomething();
> }
>
> In my special environment, I'd check for a valid DB-Connection ID and, if I don't find one, redirect the user to a longin-page.
Something like this does not belong to Cocoon but to the servlet engine.
Anyway a new design pattern called "Interceptor" has been proposed for
Tomcat that will allow you to do that. Some code is already there. Take
a look at the Tomcat CVS module at jakarta.apache.org
> This would also allow to handover "global" data (e.g. Connections) to the processors via the parameter-map and would therefore eliminate the need to code this in the document itself (see how SQLProcessor deals with connection - and with the potential security hazards associated with this method)
>
> Talking about the Sitemap Proposal:
> Don't forget to add XCatalog-Support to your configuration file. This would dramatically reduce customization efforts.
Great point. You're totally right, I knew I was missing something :)
--
Stefano Mazzocchi One must still have chaos in oneself to be
able to give birth to a dancing star.
<st...@apache.org> Friedrich Nietzsche
--------------------------------------------------------------------
Come to the first official Apache Software Foundation Conference!
------------------------- http://ApacheCon.Com ---------------------