hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <http-as...@dubioso.net>
Subject Re: RE : Problem in down loading page
Date Mon, 09 Jan 2006 14:15:17 GMT
Hello Rajapandian,

> InputStream in = method2.getResponseBodyAsStream();
>              try {
>                InputStreamReader inR = new InputStreamReader( in );
>                BufferedReader buf = new BufferedReader(inR);
>                String line = buf.readLine();
>                while ( ( line = buf.readLine() ) != null ) {
>                  System.out.println( line );
>                }
>              } finally {
>                in.close();
>              }

That looks all right, except for the InputStreamReader which is created
with the default character set instead of the character set indicated by
the server for the document. Depending on the character set of the document
and your system default settings, this may or may not cause a problem in
detecting the end of the stream. Could there be an exception from a failed
character conversion that cancels your loop unexpectedly?

Have you tried to call method2.getResponseBodyAsString() for comparison?
If that returns what you expect, the problem is hidden somewhere within
your stack of readers. If it returns the same truncated result, we'll have
to dig into the HTTP communication. In that case, please provide a wire log
of the communication. See here for logging details:



To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org

View raw message