0

I have a need to be able to share a session between an apache httpclient and a web browser.

My SWT program authenticates the user via httpclient, when the user first uses the program. Later there is a need to launch a default web browser, using the same session. I'm able to launch the user's default browser using: http://johnbokma.com/mexit/2008/08/19/java-open-url-default-browser.html

I would like a general solution, if possible. If not possible, than I would settle for a solution for IE, Chrome or FireFox. I would then try to figure out how to do it for the other two browsers.

James Oravec
  • 19,579
  • 27
  • 94
  • 160

1 Answers1

2

That's possible by adding the value of the session cookie in the URL opened by the default browser. The exact syntax of the URL depends on the webserver used. Here is an example with Tomcat: Supporting Sessions Without Cookies in Tomcat

Community
  • 1
  • 1
Emmanuel Bourg
  • 9,601
  • 3
  • 48
  • 76
  • I know the server is able to detect the browser information, however can a a client detect which app server is running? I ask because my program might run on JBoss, WebLogic or WebSphere, so if I can determine which one is which, then I could try to use this approach with some conditional logic. – James Oravec May 23 '12 at 13:48