M
Michael Fortin
Hi,
I'm using jakarta commons httpclient v3.0 and I'm trying to emulate
what I would do using a browser, like logging on to a web application
and then doing an action which requires me to be logged on.
HttpMethod method = null;
int returnCode = 0;
String response = null;
method = new GetMethod(".../login?username=mike&password=test");
returnCode = client.executeMethod(method);
response = getStringFromInputStream(method.getResponseBodyAsStream());
// the response is the "admin" page, I'm logged on!
method = new GetMethod(".../action?parameter=value");
returnCode = client.executeMethod(method);
response = getStringFromInputStream(method.getResponseBodyAsStream());
// the reponse is the login scren, I'm not authenticated
Can someone give me a hint on how I can acheve that?
Thanks,
Mike.
I'm using jakarta commons httpclient v3.0 and I'm trying to emulate
what I would do using a browser, like logging on to a web application
and then doing an action which requires me to be logged on.
HttpMethod method = null;
int returnCode = 0;
String response = null;
method = new GetMethod(".../login?username=mike&password=test");
returnCode = client.executeMethod(method);
response = getStringFromInputStream(method.getResponseBodyAsStream());
// the response is the "admin" page, I'm logged on!
method = new GetMethod(".../action?parameter=value");
returnCode = client.executeMethod(method);
response = getStringFromInputStream(method.getResponseBodyAsStream());
// the reponse is the login scren, I'm not authenticated
Can someone give me a hint on how I can acheve that?
Thanks,
Mike.