cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Pietschmann" <>
Subject Retrieving AuthenticationContext from custom Action
Date Thu, 23 Dec 2004 10:12:04 GMT
Hi guys,

I'm currently writing an action which merges some things from the request
and deli into the AuthenticationContext.

I just don't seem to get the Context, though. 
I'd prefer to get it as DOM (a Document or DocumentFragment), so I don't
really want to use streamContextFragment(..) from the sessionManager like
Cocoon's SessionPreTransformer does.

I have the ContextManager and the SessionManager. 
I tried with the AuthenticationContextProvider (though I'm really not sure
why this is needed at all), but it returned a NullPointerException.

Well, the action (shortened to the important bits) looks like this:

public void service(ServiceManager manager)... {
        try {
        catch (ProcessingException pe) {
            throw new ServiceException("Error looking up components.");

public Map act( ...) ..{

	authContext =
	System.out.println("1st way:
	System.out.println("2nd way:

So far this is only for debugging purpose to see if I get the context or not
- but it doesn't look so. This is what the console says:
1st way: [#document-fragment: null]
2nd way: [#document-fragment: null]

My first question would be: 
Which is the best way to obtain the authentication context? Via the
SessionManager, ContextManager.. or AuthenticationContextProvider? Is there
any striking difference?

Second question of course: How do I get the context??

The pipeline part looks like this:

<map:act type="auth-protect">
	<map:parameter name="handler" value="portalhandler"/>
	<!-- my action: -->
	<map:act type="updateModel">
		<map:parameter name="requestParam" value="xml:Foo"/>
	<map:transform type="session"/>
	<map:transform type="session"/>

Funnily the outputauthentication stylesheet (see below) returns the context,
so it must be possible with my action as well :O

<xsl:template match="/">
	<authContext ...>
		<session:getxml context="authentication"

Thank you for your help!

Cheers and Merry Christmas,

P.S.: Using Cocoon 2.1.6 on Tomcat 5.0.28 on JDK 1.4.2_06

View raw message