You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Raja Pandian <r....@verchaska.com> on 2005/12/30 12:30:15 UTC

problen in downloading page

hello
 
  i write a simple program whichsubmits some data to a page and 
downloads the resulting  page (using HttpClient), i got the page,but not 
able to get the whole page,the page size was large and i used 
getResponseBodyAsStream()
and read the response.i am unable to find the reason why i am not 
getting the whole page.
kindly help me to rectify from this problem

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


Re: problen in downloading page

Posted by Roland Weber <ht...@dubioso.net>.
Hello Raja,

> The status code was 200. I get the initial part of the expected page.

Then I suspect you are not reading correctly from the stream. The stream
reads only a part of the page on each call to read(...) and returns the
number of bytes read. You have to loop until you reach EOF. See here:

http://java.sun.com/j2se/1.4.2/docs/api/index.html

cheers,
  Roland

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


Re: problen in downloading page

Posted by Raja Pandian <r....@verchaska.com>.
hai Roland

The status code was 200. I get the initial part of the expected page.I 
have given all the required parameters(checked with tools >> page info 
 >> forms in the browser).The source of expected page was about 20000 
lines.I have not prepared the log files.
 I have a look at the cookies created when requested through the browser 
and requested from the application(using getCookies()).

The cookie created in browser
 Cookiename :    aaaa
Content :           name=raja&age=20&cookie=enabled

The cookie generated when requested from application
 Cookiename :
Content :      name=&age=&cookie=enabled
(name,age  are not form elements but they are alias for some of the form 
elements)

A method of setting sessioncookies were hanled .


Please help me with a  way to find out the  cookie  to be set for the 
request. Is there any way to  retrieve all the session informations.
thanks.

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


Re: problen in downloading page

Posted by Roland Weber <ht...@dubioso.net>.
Hello Raja,

>  i write a simple program whichsubmits some data to a page and downloads
> the resulting  page (using HttpClient), i got the page,but not able to
> get the whole page

Could you please be a bit more specific about what you expect and what you
get instead? What status code is in the response? Do you get only the initial
part of the page you expect, or something completely different? May there be
some kind of redirect which you didn't follow? Is the response an error page
because you forgot some required parameter in the request? You could generate
a wire log for us to analyze:

http://jakarta.apache.org/commons/httpclient/logging.html

> the page size was large and i used
> getResponseBodyAsStream()
> and read the response.

I trust you have verified the code for reading from the stream? A while back,
we had a case where somebody made a mistake there, and ended up with a much
larger file than expected. We also had cases where people did not correctly
loop when reading from the stream, therefore getting only the first block of
the response body.

cheers,
  Roland


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