简体   繁体   English

apache httpclient并生成一个将使用java共享会话的浏览器

[英]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. 我需要能够在apache httpclient和Web浏览器之间共享会话。

My SWT program authenticates the user via httpclient, when the user first uses the program. 当用户首次使用该程序时,我的SWT程序通过httpclient对用户进行身份验证。 Later there is a need to launch a default web browser, using the same session. 稍后需要使用相同的会话启动默认Web浏览器。 I'm able to launch the user's default browser using: http://johnbokma.com/mexit/2008/08/19/java-open-url-default-browser.html 我可以使用以下命令启动用户的默认浏览器: 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. 如果不可能,我会满足于IE,Chrome或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. 这可以通过在默认浏览器打开的URL中添加会话cookie的值来实现。 The exact syntax of the URL depends on the webserver used. URL的确切语法取决于所使用的Web服务器。 Here is an example with Tomcat: Supporting Sessions Without Cookies in Tomcat 以下是Tomcat的示例: 在Tomcat中支持没有Cookie的会话

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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