Hello. I'm attempting to use httpclient as the transport for a web crawler
that I'm implementing. I need to be able to handle cookies in this crawler,
and so far I have been unable to get the cookie handling to work using
httpclient. As I have been testing my test code looks like this:
URL url = new URL("http://www.bewley.net/cgi-bin/cookie-test.pl");
HttpClient client = new HttpClient();
HttpMethod method = new GetMethod("/cgi-bin/cookie-test.pl");
method.setFollowRedirects(true);
client.startSession(url);
try{
client.executeMethod(method);
}
catch (Exception ioe){
System.out.println("IOException");
}
Cookie[] cookies=client.getState().getCookies();
System.out.println(cookies[0].toString());
I have verified that the connection is being made and that the page is being
downloaded by printing the response body but I have been unable to get it to
print any cookies. I get an array index out of bounds exception. Can anyone
tell me what I'm doing wrong?
Travis
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>