如何查找 Java Web Start 应用程序的 cookie?我迷失在重定向中
我对 HTTP 处理相当陌生,我想使用 CookieHandler 类和 cookieHandler.get(...) 在 Java Web Start 应用程序中检索 cookie。
然而,由于我们的身份验证过程,存在多个重定向,我什至不确定应该查看哪个 URI!请求流程详述如下。
注意:为了解决错误,我运行了两个 http 服务器,因此您会看到两个不同的端口用于“product.company.com”——这只是暂时的。我正在使用 httpfox 转储标头,并且我已经验证每个请求都存在 cookie。
流程如下:
Browse to alias: http://product.company.com:7890/
Redirects (302) to: https://login.company.com:443/path/login?Token=<long string>
Redirects (302) to: http://product.company.com:80/success?urlc=<long string>
Redirects (301) to: http://product.company.com/success/?urlc=<long string>
application/x-java-jnlp-file (200): http://product.company.com/success/?urlc=<long string>
应用程序 jnlp 位于 /success/product.jnlp,jar 位于 /success/lib 中。代码库 =“http://product.company.com/success/”。
我已经尝试了 URI 的“http://product.company.com/”和“http://product.company.com:port/”变体,但我的所有调用都没有返回 cookie。
到目前为止,我在测试时省略了 URL 的“?fragment”部分,这可能是我的错误吗?
如果您有任何经验,您能否建议我应该如何生成我需要的 URI?有人有我可以测试的例子吗?
注意:我使用的是 Java 1.6,但如果可能的话,我希望与 Java 1.5 客户端兼容。
I'm fairly new to HTTP processing and I would like to retrieve cookies in a Java Web Start application using the CookieHandler class with cookieHandler.get(...).
However, due to our authentication process, there are multiple redirects and I'm not even sure which URI I should be looking at! The request flow is detailed below.
Note: to work around a bug, I have two http servers running so you see two different ports used for 'product.company.com' -- this is only temporary. I'm using httpfox to dump the headers and I have verified that the cookie is there for each of the requests.
Here's the flow:
Browse to alias: http://product.company.com:7890/
Redirects (302) to: https://login.company.com:443/path/login?Token=<long string>
Redirects (302) to: http://product.company.com:80/success?urlc=<long string>
Redirects (301) to: http://product.company.com/success/?urlc=<long string>
application/x-java-jnlp-file (200): http://product.company.com/success/?urlc=<long string>
The application jnlp is located at /success/product.jnlp and the jars are in /success/lib. Codebase="http://product.company.com/success/".
I've tried each of the 'http://product.company.com/' and 'http://product.company.com:port/' variations for the URI, but all my calls return no cookies.
So far, I have omitted the '?fragment' portion of the URL when testing, could that be my error?
If you have any experience, could you suggest how I should be generating the URI that I need? Does anyone have any examples I can test against?
Note: I am using Java 1.6, but I want to be compatible with Java 1.5 clients, if possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用您更熟悉的其他技术(例如 JavaScript)检查 cookie 吗?
您可以使用 java Preferences API 来保存程序的用户首选项和配置数据。你能用它来代替 cookie 吗?
Can you check the cookies using another technology you are more familiar with, like JavaScript?
You can use the java Preferences API to save user preferences and configuration data for your program. Can you use that instead of cookies?