Subject: RE: How do I use the DominoSessionManager in the Domino Tag Library?
The DominoSessionManager is basically a factory object the <domino:session …> tag needs.
All you want to do is create it with a boolean argument of false - it extends HttpSessionBindingListener, and the false argument tells the DominoSessionManager to not cleanup when the HttpSession goes away. You created it, you know best when it should go away. (So don’t forget to call the DominoSessionManager’s term() method!)
Then add the DominoSessionManager as an attribute of the HttpSession. The JSP tag library by default will look for an attribute named “lotus.domino.taglib.SessionMgrKey”. You can set it to use your own attribute name by setting a contex-param in web.xml named “lotus.domino.preset.sessionmgrkey” to the name you want.
Now the Domino JSP tags (DJSP) can find the DominoSessionManager. Every jsp that uses DJSPs will need a <domino:session tag, which hands its attributes (the username/password, host, and session duration) to the DominoSessionManager factory when asking for a Domino session. The DominoSessionManager can then look at the existing sessions and give back one that has the necessary attributes.
You also need to create another class to handle formatting portal urls and namespaces by extending lotus.domino.taglib.ContainerAdapter, and registering an instance of it by calling ContainerAdapterAccess.setInstance(yourinstance); There are examples in some of the Lotusphere demos, let me know if you can’t find them.
You know my company suggests using a different, way better class than javax.portlet.GenericPortlet, but if you must, you must. Where ever you decide to create the DominoSessionManager, you can check the HttpSession attribute to see if a DominoSessionManager is already there, and only create it when it isn’t. If you are going to present your users with a login screen, then the GenericPortlet.processAction might be a good place that would cause you to check just once.
You still need to track ‘logout’, which means you would need to create your own HttpSessionBindingListener, which makes me wonder if you are working too hard.
What if you didn’t create a DominoSessionManager? What if the processAction for handling login were to invoke a jsp that has a <domino:session duration=“session” user, password, host > tag on it. The DJSP will create the DominoSessionManager, and store it in the default named attribute - “lotus.domino.taglib.SessionMgrKey”. Back in processAction, go get it and put it where your other portlets can find it! That way the DominoSessionManager will clean up if the HttpSession ends, and you don’t have to implement a ‘logout’ step…
(You also want to set a fairly short iiop connection timeout on your Domino server - default is 60 minutes, something like 3 might be better when using <domino:session duration=“session”…)
Good Luck - please post your progress!!
-sl