HttpURLConnection: Setting Cookies For Authentication
Posted on 2005-04-12
I am trying to access a URL in my Java code that requires a login using the usual form box. As I am fimiliar with the website I know that all I need to capture for authentication is a 'jsessionid' variable and use this for future communication with the site.
How do I set this cookie value, I am trying:-
HttpURLConnection connection = (HttpURLConnection)testUrl.openConnection();
However this will not work as I am trying to access the secure page, 'testUrl', before I have set the cookie value