You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Roger Hyam <ro...@hyam.net> on 2004/10/07 15:02:07 UTC

Starting a session with an action.

I am having problems with sessions.

I need the entry point for my application to be a post or get from 
somewhere in the outside world. Some of the parameters in the request
need to be written to the session and then the user sent on to view
a resource on the basis of the parameters in their session. Subsequent
visits will result in the user getting the write resource until their
session ends.

The chunk of site map belows shows what I am doing.

Trouble with this is that if the session does not exist then the
session-propagator action throws an error (returns null).

How can I start a session in this matcher before we get to the
session-propagator?

Do I need to write my own action or xsp or am I doing something
dumb?

Any suggestions would be most welcome.

<!-- authorise the user and set up their session -->
<map:match pattern="auth.html" >

   <!-- load the request parameters into the Map -->
   <map:act type="request">

     <!-- write all the request params to the pipeline -->
     <map:parameter name="parameters" value="true"/>

     <!-- default some of them, just incase they aren't set -->
     <map:parameter name="default.format" value="default"/>
     <map:parameter name="default.brand" value="default"/>
     <map:parameter name="default.mode" value="view"/>

     <!-- put some of these parameters into the session -->
     <map:act type="session-propagator">

       <map:parameter name="student_id" value="{student_id}" />
       <map:parameter name="teacher_id" value="{teacher_id}" />
       <map:parameter name="module_id" value="{module_id}" />
       <map:parameter name="format" value="{format}" />
       <map:parameter name="brand" value="{brand}" />

       <!-- all done so send them on to view the module they request -->
       <map:redirect-to uri="view.html"/>

     </map:act>
     <map:read mime-type="text/html" src="error.html" />

   </map:act>

   <map:read mime-type="text/html" src="error.html" />

</map:match>


(Once this is working there will actually be another action in here
that does exciting stuff with public/private keys past to check
we can believe the info being past in. So I don't intend to naively
believe what the user posts in the future...)


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


Re: Starting a session with an action.

Posted by Roger Hyam <ro...@hyam.net>.
Thanks for this Nick. Just what I need.

Didn't find it before because it is in an odd package. I was looking in 
org.apache.cocoon.acting before. Is there away the API doc could be 
annoted to this I wonder?

I'll check out the authentication framework as well.


Nick Goupinets wrote:
> Hi Roger,
> 
> I don't know if this will help, but there is a Session Action
> 
> http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/webapps/session/acting/SessionAction.html 
> 
> 
> It allows one to create and delete sessions.
> 
> BTW, If you are planning on using authentication, you might want to take 
> a look at the authentication framework. I think it does session handling 
> for you.
> 
> Sincerely,
> Nick Goupinets
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 

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


Re: Starting a session with an action.

Posted by Nick Goupinets <ng...@cogeco.net>.
Hi Roger,

I don't know if this will help, but there is a Session Action

http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/webapps/session/acting/SessionAction.html

It allows one to create and delete sessions.

BTW, If you are planning on using authentication, you might want to take 
a look at the authentication framework. I think it does session handling 
for you.

Sincerely,
Nick Goupinets


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