wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Starting browsers not in same session Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Starting browsers not in same session" Watch "Starting browsers not in same session" New topic
Author

Starting browsers not in same session

Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
This is sort-of Java, sort-of Web stuff and sort-of General Computing. But here it is in the Web tech forum...

I have a Java server application with a Web user interface. The customer insisted that the Java server application start-up should fire up a Web browser to display the user interface on the machine that is running the server. I used "rundll32 url.dll,FileProtocolHandler" on Windows and com.apple.eio.FileManager.openURL() on Mac OS X to achieve this.

Although lacking control (there are no parameters apart from URL), this has been reasonably successful until now. Now the server application has two Web user interfaces. These are both supposed to fire up when the Java server application starts.

The methods described above are perfectly capable of starting two, or more, Web browsers. Unfortunately, they usually all seem to end up in the same HTTP session. This is a bit of a disaster, as they tread all over each other's session data.

Any ideas how I might avoid this problem? Ideally, a way to start up multiple browsers and be sure they are in separate HTTP sessions.

Note that I already tried using java.awt.Desktop from Java 6. Behaves the same as my existing code. It probably works the same inside...


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
If you open the two browsers manually in a tradional manner, do you run into the same problem?

Maybe implement a cookieless session? [stab in the dark]

Eric
[ August 08, 2007: Message edited by: Eric Pascarello ]
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
When the browsers are opened separately "manually", there is no problem. You get two separate sessions and both applications work fine.

Your comment about cookies is interesting. I wonder whether it may explain why some browsers have the problem and some don't. Sounds like something for me to investigate.
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
It seems that completely disabling cookies does fix the problem, in FireFox and Internet Explorer.

I would prefer if we didn't require users to go changing their Web browser configuration. Is there a way to tell Java (Servlets?) never to use cookies, even when they are available in the browser?

My application uses Jetty 4 Web server, embedded - if this matters.
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
Yes, Jetty has such a switch. So the problem, which seemed intractable, is in fact fixed with just a single line change.

Thanks, Eric!
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
I am guessing my wild idea worked...lol

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Starting browsers not in same session