Title: RE: classpath for third party tools
Hi all,
 
I'll be darned if I thought I had this problem licked. Here is the deal..I am running 3 web-apps in one application (one instace of Orion). Each web-app has its own context if I am not mistaken, which means that one context can not share data with any other context that is running. What I need to happen is allow 3 browsers access the 3 apps. All 3 apps point to the same one www dir on the local drive, but each has a context root name of /admin/mediaName where mediaName is radio, tv or cable. So, you would type in http://xxx.xxx.xxx.xxx/admin/radio http://xxx.xxx.xxx.xxx/admin/tv or http://xxx.xxx.xxx.xxx/admin/cable Now the problem is, each has a database associated with them (we run 3 databases, one for each media type). A special HttpSession object (String type) indicates the media type your in based on the Context path. I use the call request.getContextPath() which returns /admin/radio, /admin/tv or /admin/cable depending on what was typed, and store the Integer equivalent in the String MediaType in the HttpSession. All servlets/actions (using struts framework) use this stored value to determine what database to hit to get the data. This should work, and does seem to work if I use the same one browser to log in with. If I open two windows, and log in to radio, then cable (in the 2nd browser), then pull up a query on some stuff that, it seems to show the radio data, even though I am using a browser with the /admin/cable context in the URL line. When I run the Console and look at the HttpSession data, /admin/cable shows a MediaType of 3 (Cable) which is correct, yet it still seems to be pulling radio date.
 
So, what I have figured out is that somehow, when I log in to radio first, then into cable, even though a HttpSession is created in the /admin/cable web-app, the actual session being retrieved is that of the /admin/radio web-app, which is the only way I can explain it getting radio data. The reason this is the only way is that the "logic" classes use the MediaType value set when the logic class is created (a call to new with its constructor being passed the media type). So, I think the problem is, why in a 2nd window, when I clearly log in to /admin/cable and the session is created (in the Orion console) in the /admin/cable web-app, is it somehow getting the /admin/radio session when the query is performed.
 
I wish there was some way to test this. I think I have an idea, but it would be kewl if the Orion app showed an "access counter" to each object or something..if thats possible.
 
Anyways, I just wanted to see if anyone else has ever had this problem. Before answering, I do know before Servlet 2.2, that it was impossible without some working, to allow multiple browsers of the same type (MSIE for example) to have multiple sessions going. I thought I understood the Servlet 2.2 spec to read that the context path in the URL of the request determines where it looks for the session, then would use the cookie to get the proper session for the request. It doesn't appear to be doing this for me, so if I am wrong, please enlighten me.
 
Thanks.
 

Reply via email to