cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Pietschmann" <dev.sen...@gmail.com>
Subject AW: Access to the AuthenticationContext
Date Mon, 09 Jan 2006 11:56:24 GMT
| Jean-Baptiste Quenot [mailto:jbq@anyware-tech.com]
| 
| * Stefan Pietschmann:
| 
| > So, am I  supposed to use this  or not? If not, what  would be a
| > better way?
| 
| Don't  getSitemapComponentManager().   Why   don't  you  use  your
| ServiceManager to lookup the component?

Well, how? I don't know what I'm supposed to lookup! As I said... strangely
enough when I lookup the SessionManager from my ServiceManager I get null.
Once I look it up from the ComponentManager I get from
getSitemapComponentManager() it works.

ComponentManager componentManager =  
    CocoonComponentManager.getSitemapComponentManager();
sessionManager = (SessionManager) 
    componentManager.lookup(SessionManager.ROLE);

works, but 

sessionManager = (SessionManager) manager.lookup(SessionManager.ROLE);

doesn't.

| 
| You can also use the « session-context » input module to retrieve
| the piece of information more nicely:
| 
|     public static String getInputModuleAttribute(ServiceManager manager,
| String module, String value) {
|                 InputModule inputModule;
|                 try {
|                         ServiceSelector selector = (ServiceSelector)
| manager.lookup(InputModule.ROLE + "Selector");
|                         inputModule =
| (InputModule)selector.select(module);
|                         return (String) inputModule.getAttribute(value,
| null, null);
|                 } catch (ServiceException e1) {
|                         throw new CascadingRuntimeException("Could not
| select " + module + " input module", e1);
|                 } catch (ConfigurationException e1) {
|                         throw new CascadingRuntimeException("Could not get
| input module value for " + module + ":" + value, e1);
|                 }
|     }

No idea about this. I haven't worked with InputModules yet, so feel free to
correct me.
I would actually call this like
getInputModuleAttribute(manager,"session-context","/authentication/id")? And
it would return the 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.

Thank you,
Stefan
 
| Cheers,
| --
| 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/


Mime
View raw message