Use org.apache.http.impl.client.BasicResponseHandler if you just need
a String.
Also, you can use  org.apache.http.util.EntityUtils class to retrieve
the response in different forms or write your own ResponseHandler.

-Chander

On Dec 28, 10:33 pm, Maurice <[email protected]> wrote:
> Hi
>
> My (client)application connects to a Tomcat server through http post
> requests.
> My problem is that the application sometimes does not get the complete
> response.
> The last X bytes are missing.
> The length of a response is, however, below 1K (did not count or
> measure it).
>
> My application retrieves data from the Tomcat server at various
> moments in time. I also have a PC version of the application that has
> exactly the same code-base for this part. On the PC there is not a
> problem.
> Also, it does not happen all the time. I cannot pinpoint when it goes
> right and when wrong.
> It seems like a timing problem.
>
> I tried several things to solve the problem. This ranges from reading
> the result of the post two times to letting the thread sleep at
> various places in the code.
> None of the solutions are a silver bullets, although the problem seems
> less frequent.
>
> So maybe I'm doing something wrong.
>
> Did somebody have a similar problem?
> Should I post requests, or readout the response in a different way?
>
> My code is as follows:
>
> import org.apache.http.HttpEntity;
> import org.apache.http.HttpResponse;
> import org.apache.http.client.methods.HttpPost;
>
> HttpPost httpost = new HttpPost(aUrl);
> HttpResponse response = RL.getHttpClient().execute(httpost);
> HttpEntity entity = response.getEntity();
>
> if (entity != null) {
>    br = new BufferedReader(new InputStreamReader(entity.getContent
> ())) ;
>
> } else {
>   br = null ;
> }
>
> BufferedReader is read out by using the method readLine()
>
> Any help is appreciated.
>
> Regards,
>
> Maurice

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to