Hi Oleg,

1) Thanks for responding. I am new to using httpclient, but in our case, I
observed that if i do comment the preemptive authentication code, then the
executeMethod( ) causes a "HttpRecoverableException" exception to be thrown.
Also I observed the following line at the console where the exception was
printed as shown below.....

Also note that currently i was using the tutorial code provided on the site
to connect to some url outside our proxy. If I include the line ...
"client.getState().setAuthenticationPreemptive(true); ,
then the error below goes away and i get the correct response( ie the html
page of the site).

****************************************************************************
*************
Feb 26, 2004 9:15:51 AM org.apache.commons.httpclient.HttpMethodBase
processRequest
INFO: Recoverable exception caught when processing request
Feb 26, 2004 9:15:51 AM org.apache.commons.httpclient.HttpMethodBase
processRequest
WARNING: Recoverable exception caught but MethodRetryHandler.retryMethod()
returned false, rethrowing exception
A recoverable exception occurred,
rfile:///C:/Documents%20and%20Settings/Saifadam/Desktop/howtomworks/commons-
httpclient
-2.0/docs/logging.htmletrying.org.apache.commons.httpclient.HttpRecoverableE
xception: Error in parsing the status  line
from the response: unable to find line starting with "HTTP"
Failed to download file.
org.apache.commons.httpclient.HttpException: Already used, but not recycled.
        at
org.apache.commons.httpclient.HttpMethodBase.checkExecuteConditions(HttpMeth
odBase.java:1007)
        at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:105
2)
        at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:675)
        at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:529)
        at HttpClientTutorial.main(HttpClientTutorial.java:49)

****************************************************************************
*************

2) When i specify the url as "http://www.google.com/"; in the tutorial code
then i get the following message. What is the cause/ resolution (preferably
for auto redirection)?
**********************************************************************
Feb 26, 2004 9:29:13 AM org.apache.commons.httpclient.HttpMethodBase
checkValidRedirect
WARNING: Error getting URI host
org.apache.commons.httpclient.HttpException: Redirect from host
www.google.com to www.google.co.in is not supported
        at
org.apache.commons.httpclient.HttpMethodBase.checkValidRedirect(HttpMethodBa
se.java:1243)
        at
org.apache.commons.httpclient.HttpMethodBase.processRedirectResponse(HttpMet
hodBase.java:1191)
        at
org.apache.commons.httpclient.HttpMethodBase.isRetryNeeded(HttpMethodBase.ja
va:977)
        at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:109
5)
        at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:675)
        at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:529)
        at HttpClientTutorial.main(HttpClientTutorial.java:49)
Feb 26, 2004 9:29:13 AM org.apache.commons.httpclient.HttpMethodBase
processRedirectResponse
WARNING: Invalid Redirect URI from: http://www.google.com:80/ to:
http://www.google.co.in/cxfer?c=PREF%3D:TM%3D107776800
8:S%3DPvB14qU5aHKd-lIe
Request returned is :
 <HTML><HEAD><TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A
HREF="http://www.google.co.in/cxfer?c=PREF%3D:TM%3D1077768008:S%3DPvB14qU5aH
Kd-lIe">here</A>.
</BODY></HTML>
**********************************************************************
Regards...

Saif


----- Original Message -----
From: "Kalnichevski, Oleg" <[EMAIL PROTECTED]>
To: "Commons HttpClient Project" <[EMAIL PROTECTED]>
Sent: Wednesday, February 25, 2004 9:25 PM
Subject: RE: Connecting through Proxy



Just one (relatively minor) addition: only Basic authentication can be used
preemptively. NTLM authentication scheme is stateful (that is, NTLM
authentication process spans across several requests/responses) and
therefore NTLM credentials cannot be used outside a valid authentication
context.

Saifadam,
Do you intentionally use preemptive authentication or was it the only you
could get the proxy authentication work for you? Are you using HTTPS by any
chance?

Oleg


-----Original Message-----
From: Stefan Dingfelder [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 25, 2004 16:43
To: Commons HttpClient Project
Subject: Re: Connecting through Proxy


Hi Saifadam,

that may depend upon the proxy also. If it is a Microsoft proxy you need
to use NTLM authentification which requires NTCredentials.
http://jakarta.apache.org/commons/httpclient/authentication.html
contains some further infos. At least that was what I needed.

Just my two cents,
 Stefan Dingfelder

Saifadam Pathan schrieb:

> I tried numerous suggestions from the list on how to authenticate via
> proxy when you try the httpclient. But noe worked. Then i ended up
> using these steps...
>
>
/***************************************************************************
*****************************************
> */
>
> HttpClient client = new HttpClient();
>
>
>     client.getState().setAuthenticationPreemptive(true);
>     client.getHostConfiguration().setProxy("proxyHost", nProxyPortNo);
>                         // proxyHost is location of proxy server
> (ipaddress)
>
>     client.getState().setProxyCredentials(null, null, new
>                     UsernamePasswordCredentials("proxyusername",
> "proxypassword"));
>
>
>     // Create a method instance.
>     HttpMethod method = new GetMethod(url);
>
/***************************************************************************
*****************************************
> */
>
>
> Hope this will help someone else save their time.
>
> Regards...
>
> Saifadam Pathan
> Project Engineer
> ControlNet India Pvt Ltd.
> Goa- India
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail:
[EMAIL PROTECTED]
>For additional commands, e-mail:
[EMAIL PROTECTED]
>



---------------------------------------------------------------------
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]


****************************************************************************
***********************
The information in this email is confidential and may be legally privileged.
Access to this email by anyone other than the intended addressee is
unauthorized.  If you are not the intended recipient of this message, any
review, disclosure, copying, distribution, retention, or any action taken or
omitted to be taken in reliance on it is prohibited and may be unlawful.  If
you are not the intended recipient, please reply to or forward a copy of
this message to the sender and delete the message, any attachments, and any
copies thereof from your system.
****************************************************************************
***********************

---------------------------------------------------------------------
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to