Hi Aaron,
Thanks for your email and ideas!
I had always thought about expanding the RequestParamAction to include
session and config values/etc - essentially turning it into an
EnvironmentAction or something similar.
If you post your source, we could combine forces and come up
with a generic environment action ? What do you think ?
Cheers,
Marcus
On Thu, 18 Oct 2001, SANSONE, AARON M [Non-Pharmacia/1000] wrote:
> Hi everyone,
>
> I needed to make some session attributes available to the sitemap. Looking
> through the Cocoon API, I can't find such an action. The RequestParamAction
> is the closest to what I need but it is only for the Request object. I have
> written a SessionParamAction that mirrors what the RequestParamAction does
> except that it works for the session.
>
> My question is, should I contribute this to the Project? Secondly, if this
> is to be contributed, I am in a quandary as to where this code belongs.
> Currently the existing RequestParamAction places the Request Parameters into
> the Map only if the "parameters" value is set to true:
>
> <map:act type="request">
> <map:parameter name="parameters" value="true"/>
> <map:generate src="users/menu-{id}.xml"/>
> </map:act>
>
> A new SessionParamAction could make the previous code look like:
>
> <map:act type="request">
> <map:act type="session">
> <map:parameter name="parameters" value="true"/>
> <map:generate src="{sessionpath}/users/menu-{id}.xml"/>
> </map:act>
> </map:act>
>
> I could easily refactor the RequestParamAction to take a separate parameter
> for the session attributes thus simplifying the previous code to:
>
> <map:act type="request">
> <map:parameter name="parameters" value="true"/>
> <map:parameter name="session_attributes" value="true"/>
> <map:generate src="{sessionpath}/users/menu-{id}.xml"/>
> </map:act>
>
> Or create a new Action (RequestSessionParamAction)
>
> <map:act type="request-session">
> <map:parameter name="parameters" value="true"/>
> <map:parameter name="attributes" value="true"/>
> <map:generate src="{sessionpath}/users/menu-{id}.xml"/>
> </map:act>
>
> One issue with either approach is the precedence of request values vs.
> session values of the same name. I believe that in the case where the
> request and session actions are separated, the precedence is dependant on
> which action is specified last. For example if request has a parameter
> name=Aaron and the session has an attribute name=Michael then if the session
> is specified after the request, the substitution of the {name} would yield
> Michael from the session action.
>
> This is predictable and easily changed if you wish to have the request take
> precedence over the session by switching the order in the sitemap. If it is
> refactored to a single Action that doesn't replace the RequestParamAction
> (i.e. RequestSessionParameterAction) an additional parameter would need to
> be provided to change the order of precedence (assuming some default).
>
> What would be the best solution?
>
> This is a similar question to one that I just read from Paolo.
>
> Thanks,
> Aaron
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]
>
>
--
.....
,,$$$$$$$$$, Marcus Crafter
;$' '$$$$: Computer Systems Engineer
$: $$$$: Managesoft GmbH
$ o_)$$$: 82-84 Mainzer Landstrasse
;$, _/\ &&:' 60327 Frankfurt Germany
' /( &&&
\_&&&&' Email : [EMAIL PROTECTED]
&&&&. Business Hours : +49 69 9757 200
&&&&&&&:
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]