How do I use the DominoSessionManager in the Domino Tag Library?

Hi,

I was wondering if anyone has any documentation on how to use the DominoSessionManager in the Domino Tag Library? I’ve added lotus.domino.preset.sessionmgrkey to my web.xml. I’ve updated my code to include the creation of the DominoSessionManager. I have also set my session duration to session. So, where do you set the host and user name and all that fun stuff? It doesn’t look like the DominoSessionManager has any methods to do that. Can someone explain how that is done?

Thanks,

Eric

Subject: How do I use the DominoSessionManager in the Domino Tag Library?

What do you want the DominoSessionManager to do for you?

It is used by the Domino JSP tag library, and while there is a way for you create it, unless you are writing portlets, it’s hard to see an advantage to you doing so.

The DominoSessionManager is perhaps too impressively named. There should be one per HttpSession between a browser and the web server. Another way of saying it is that there is one DominoSessionManager per web application user.

Since a portal page may contain the output of many web apps/portlets - all generated for one user - the DominoSessionManager can be passed between portlets to avoid having each portlet repeat the same authentication steps to create a Domino session. See the redbook on ‘portalizing domino applications’ for more info.

If you are not writing portlets, you may want to explore what the <domino:session duration=“session” …> can do for you.

Hope that helps!

-sl

Subject: RE: How do I use the DominoSessionManager in the Domino Tag Library?

Hi Steve,

Thank you for responding! I saw some of your replies to others on the forum, so I was hoping you would see this one.

So, the answer is… yes! We are trying to develop some custom Domino portlets within the Vignette portal server. Of course, all of the examples I have seen involve Websphere Portal and the use of the Jetspeed portlet model.

What I am trying to do is to create a pure JSR 168 application that I can run on Vignette’s portal. From the examples I have seen, they are not extending GenericPortlet like I am and they are using login and logout methods that GenericPortlet does not have.

So, I guess my question is… I set the context params in the web.xml file. So now, should I put the DominoSessionManager creation code in my doView method? If so, where do I tell the session who I want to login as? Do I put that in the domino:session tag? I’m at a loss!

Thanks again for the help.

Eric

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

Subject: RE: How do I use the DominoSessionManager in the Domino Tag Library?

Hi Steve,

Thank you for the response. I will give it a go and see what if I can get things working.

A question about your post… you stated “You know my company suggests using a different, way better class than javax.portlet.GenericPortlet.” I don’t have any allegiance so I was just wondering… are you referring to the PortletAdapter class that is mentioned in the Redbooks, etc. as the alternative and, if so, am I able to use that in another vendor’s portal container. (i.e. Vignette) :slight_smile:

Thanks again for the help,

I’ll let you know when, or if I get it to work.

Thanks,

Eric

Subject: RE: How do I use the DominoSessionManager in the Domino Tag Library?

Yes, I was refering to the jetspeed PortletAdapter- and I while I was joking, it really does provide a lot of useful default behavior.

I don’t know anything about Vignette, but my guess is that you wouldn’t want to mix in if it’s not already there.

What made you choose Vignette over the other portal servers?

Take care,

-sl

Subject: RE: How do I use the DominoSessionManager in the Domino Tag Library?

When we did our portal comparison, Websphere was not at the current level that it is at today. In the version we were shown, it did not have delegated admin functionality which was a show-stopper for us. That, and I think the initial meeting (or “sales call”) spent more time explaining all of the different servers and products that needed to be in place rather than what the portal could do. Unfortunately, that was a big turnoff to the non-technical folks in the room. Plus the meeting used all slides where the others gave live demos that actually showed the server in use.

We also took a look at Plumtree and off the top of my head, I don’t remember why that one didn’t fly.

Eric

Subject: I found the Lotusphere presentation and I have a question…

I see the following line in the PortletContainerAdapter:

PortletRequest request = (PortletRequest)ThreadAttributesManager.getAttribute(“org.apache.jetspeed.portletcontainer.portlet.request”);

Where do you get the “org.apache.jetspeed.portletcontainer.portlet.request” part? I mean, I know what Jetspeed is, but I am using Vignette, so would that value be… “com.vignette.request” or something like that? I guess my question is… where else is that value used that it needs to match?

One other question sort of relates to my other post… I couldn’t find the PortletAdapter class in the jars provided in the LotusSphere demo. Is that in the portal.jar of the server or something?

Thanks for the help… I’m just getting a handle on portlets, so you’re help is greatly appreciated!

Thanks,

Eric

Subject: RE: I found the Lotusphere presentation and I have a question…

The problem that you sometimes run into in IBM’s Portal server is that you very rarely have exactly the type of object you wanted - yes, what you get supports the interfaces you need, but if you are looking to get at javax.servlet .http.* object from a call to that interface, most often you get back another object designed to keep you in the portlet object hierarchy.

So I think you’ll see most methods in the ContainerAdapter take a PageContext object, but they don’t use it to get the request or repsonse object, they use the ThreadAttributesManager instead, and cast the return value to a PortletResponse/PortletRequest.

You need to understand what Vignette suggests for formatting urls and for writing portal safe javascript using namespaces. That’s what’s supposed to happen in the ContainerAdapter, and I don’t know if any of what you got in the demo really pertains to Vignette.

Sounds like you are on the right track!

-sl