简体   繁体   中英

apache httpclient and spawning a browser that will share the session using java

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM