hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ashish Kulkarni" <ashish.kulkarn...@gmail.com>
Subject Basic Authentication Issue
Date Tue, 20 May 2008 14:51:08 GMT
Hi
I have PDF file to download from a server which has basic authentication,
I have the following code, but it gives 401 error, but if i take the same
url in a browser and then enter user id, password in the popup box it works,
so what may be the issue

HttpClient client = new HttpClient();

client.getState().setCredentials(
new AuthScope("http://uskzoas163/MpssDocDisplay/", 80),
new UsernamePasswordCredentials(userId, password)
);

GetMethod method = new GetMethod("
http://uskzoas163/MpssDocDisplay/ALTERNATE/PMS-PAD/V_1/00-625080-000_PMS.pdf
");
method.setDoAuthentication( true );
method.getParams().setParameter(HttpMethodParams.RETRY_HANDLER,
new DefaultHttpMethodRetryHandler(3, false));

int statusCode = client.executeMethod(method);

status i get is 401, not authorised,
Ashish

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message