Hmpf, I don't get it to work. Btw, I get the context from the SessionManager, but you made me curious about the session-context input module (mainly because the XPath). Here's my method (I have the manager object as an instance variable and only use the session-context, so it slightly differs from the method proposed by John):
private String getInputModuleAttribute(String path) { ServiceSelector selector = (ServiceSelector) manager.lookup(InputModule.ROLE + "Selector"); InputModule inputModule = (InputModule) selector.select("session-context"); return (String) inputModule.getAttribute(path, null, null); } Of course I handle the exceptions (and none is thrown btw), but I left that out for readability purposes. So I tried many ways to get just one parameter: getInputModuleAttribute("//id")); getInputModuleAttribute("/authentication/ID")); getInputModuleAttribute("//ID")); getInputModuleAttribute("session-context:authentication/ID")); getInputModuleAttribute("session-context:authentication//ID")); getInputModuleAttribute("session-context:authentication/authentication/ID")) ; but all I get in return is null. http://cocoon.apache.org/2.1/apidocs/org/apache/cocoon/webapps/session/compo nents/ContextInputModule.html#getAttribute(java.lang.String,%20org.apache.av alon.framework.configuration.Configuration,%20java.util.Map) says, that null is returned if the value doesn't exist. Huh? The value is there - I can get it by calling sessionManager.getContextFragment("authentication", "/authentication/ID")). Where's my daily mistake this time? :) Cheers, Stefan | -----Ursprüngliche Nachricht----- | Von: Jean-Baptiste Quenot [mailto:[EMAIL PROTECTED] | Gesendet: Montag, 9. Januar 2006 13:15 | An: dev@cocoon.apache.org | Betreff: Re: Access to the AuthenticationContext | | * Stefan Pietschmann: | > | You can also use the « session-context » input module to retrieve | > | the piece of information more nicely: | > | > I would actually call this like | > getInputModuleAttribute(manager,"session-context","/authentication/id")? | And | > it would return the id? | | Yes, quite: getInputModuleAttribute(manager,"session- | context","authentication/authentication/id") | | > Even if so, I don't always have the full xpath and have to search for | the | > node, which would be kinda hard this way. | | You can use an XPath expression like: | | getInputModuleAttribute(manager,"session-context","//id") | | Best regards, | -- | Jean-Baptiste Quenot | Systèmes d'Information | ANYWARE TECHNOLOGIES | Tel : +33 (0)5 61 00 52 90 | Fax : +33 (0)5 61 00 51 46 | http://www.anyware-tech.com/