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/'开发者_Python百科 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.
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?
精彩评论