Hi Roland and others,
Thanks for the feedback. Would this help?
[code]
HttpClient client = new HttpClient();
// Sends uname/pword in clear text over Internet. Only use in
debug mode
Credentials defaultCredentials = new
UsernamePasswordCredentials (uname,
pword.toString());
client.getState().setCredentials(AuthScope.ANY,
defaultCredentials);
client.getState().setCredentials(new AuthScope(HOST, PORT,
AuthScope.ANY_REALM), defaultCredentials);
// ======= New code ========================
// TODO Check that a connection is made
HttpMethod method = new GetMethod(HOST);
if (method.getStatusCode() == 200)
// We have a connection
// ======= New code ========================
[/code]
I tried the addition of the last two lines. But it threw a
NullPointerException in
org.apache.commons.httpclient.HttpMethodBase.getStatusCode
(HttpMethodBase.java:570)
Might it be that at the moment I request the status code
(method.getStatusCode() ) the statusLine is not instantiated (yes, as this
is the definition of a NullPointerException)?
TIA,
Abel
Roland Weber wrote:
>
> Hello Abel,
>
> That depends on the website to which you log in.
> Check if you get the page you would expect after
> logging in with a browser.
>
> hope that helps,
> Roland
>
>
--
View this message in context:
http://www.nabble.com/Check-if-user-is-logged-in--tp15062780p15087798.html
Sent from the HttpClient-User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]