You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by fadi qutaishat <fa...@yahoo.com> on 2005/04/04 20:10:33 UTC
session example
Hi all ,
I think I getting confused in suing the cocoon session. I think I am not clear with defining the right configuration for a session inside a pipeline. Please could some one send me an example on how to use and configure a session in a pipeline, it would be great if the example uses the session transformer and loads data from a database for its context.
I have read the cocoon documentation but I did not manage to completely implement the concept of the session.
Many thanks,
Fadi
---------------------------------
Yahoo! Messenger
Show us what our next emoticon should look like. Join the fun.
Re: session example
Posted by Aurélien DEHAY <ad...@zorel.org>.
Le lundi 04 avril 2005 à 11:10 -0700, fadi qutaishat a écrit :
> Hi all ,
>
Hello.
>
>
> I think I getting confused in suing the cocoon session. I think I am
> not clear with defining the right configuration for a session inside
> a pipeline. Please could some one send me an example on how to use and
> configure a session in a pipeline, it would be great if the example
> uses the session transformer and loads data from a database for its
> context.
>
>
>
> I have read the cocoon documentation but I did not manage to
> completely implement the concept of the session.
Will try to explain what we have done in our app. First of all, if you
didn't done this, maybe you could read:
http://cocoon.apache.org/2.1/developing/webapps/contexts.html
and
http://cocoon.apache.org/2.1/developing/webapps/authentication.html
First, use of session-fw and auth-fw. We've got a normal auth-fw use. As
you must generate a session-fw compatible xml stream in the
«authenticate» pipeline match , you're already have a session context.
The database access done in the authentication match (we're using XSP, a
login.xsp with esql).
Then, the session transformer is used to display information for users.
We've got the following match:
<map:match pattern="authentification.xdoc">
<map:act type="auth-loggedIn">
<map:parameter name="handler" value="myotishandler"/>
<map:act type="auth-protect">
<map:parameter name="handler" value="myotishandler"/>
<map:generate src="backend/session.xml"/>
<map:transform type="session"/>
<map:transform src="xsl/session2xdoc.xsl"/>
<map:serialize type="xml"/>
</map:act>
</map:act>
<map:generate type="serverpages" src="backend/login/remplir.xsp"/>
<map:transform src="xsl/authxdoc.xsl"/>
<map:serialize type="xml"/>
</map:match>
If the use is logged in, we display the content of backend session.xml
(see below for content), with the session-transformer and a xsl
transformer.
Here is the content of session.xml:
<content xmlns:session="http://apache.org/cocoon/session/1.0">
<auth>
<title>Authentification</title>
<session:getxml context="authentication" path="/"/>
</auth>
</content>
The session tranformer transform this file in a stream like this:
<authentication>
<ID>Unique ID of the user in the system</ID>
<role>rolename</role> <!-- optional -->
<data>
Any additional optional information can be supplied here.
This will be stored in the session for later retrieval
</data>
</authentication>
If the user is not authenticated, we display the login box.
Hope this helps.
Rgds.
>
--
Aurélien DEHAY http://zorel.org
http://logicielslibres.info