// If we get back a response code of 302, it means we were
// redirected to the context root after successfully logging in.
// If we receive anything else, we didn't log in correctly.
if (connection.getResponseCode() != 302)
{
throw new ChainedRuntimeException("Unable to login, "
+ "probably due to bad username/password. Received a ["
+ connection.getResponseCode() + "] response code and "
+ "was expecting a [302]");
}
}
catch (Throwable e)
{
throw new ChainedRuntimeException("Failed to authenticate "
+ "the principal", e);
}
}