Hi

My application connects to a Tomcat server through http post requests.
My problem is that I sometimes do not get the complete response,
however, if I let the thread sleep before filling the BufferedReader
there is not a problem (at least not yet). I wonder if there is a
workaround for the sleep.

Note: it does not happen always. I'm afraid that the sleep may not be
sufficient in future. Besides, it slows down the execution of the
application.

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(url);
HttpResponse response = RL.getHttpClient().execute(httpost);
HttpEntity entity = response.getEntity();
try {
  Thread.sleep(1000) ;
} catch (Exception e) {
}

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