[android-developers] Re: Reading the headers in server after HTTP Post

2012-10-26 Thread Archana
Yes it seems to work! I will get real devices next week. Later, I will test on those. On Tuesday, October 23, 2012 9:44:57 PM UTC+3, Archana wrote: > > Hi, I did a HTTP Post from client. In server, I am able to see like, > POST /HTTP/ 1.1 > Content Length: 41 > Content-type: application/json >

[android-developers] Re: Reading the headers in server after HTTP Post

2012-10-26 Thread skink
Archana wrote: > Hi, > > So should I set the status code using Apache Core like > HttpResponse response = new > BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK"); > response.setEntity(new StringEntity("Got it")); > conn.sendResponseHeader(response); > conn

[android-developers] Re: Reading the headers in server after HTTP Post

2012-10-26 Thread Archana
Hi, So should I set the status code using Apache Core like HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 200, "OK"); response.setEntity(new StringEntity("Got it")); conn.sendResponseHeader(response); conn.sendResponseEntity(response);

[android-developers] Re: Reading the headers in server after HTTP Post

2012-10-26 Thread skink
Archana wrote: > Hi, > > If I use Sockets to post the JSON(instead of HTTP Post), how will I > retrieve the JSON and status code in the server? > Also with HTTP Post, I want to retreive both(the status code and JSON). Can > you please suggest an example? > > Thanks! > what status code? a status

[android-developers] Re: Reading the headers in server after HTTP Post

2012-10-26 Thread Archana
Hi, If I use Sockets to post the JSON(instead of HTTP Post), how will I retrieve the JSON and status code in the server? Also with HTTP Post, I want to retreive both(the status code and JSON). Can you please suggest an example? Thanks! On Wednesday, October 24, 2012 3:29:16 PM UTC+3, skink w

[android-developers] Re: Reading the headers in server after HTTP Post

2012-10-24 Thread Archana
Thank you for your support! As I am still a learner(with just 3 months working in Android), I have some problems. On Wednesday, October 24, 2012 3:29:16 PM UTC+3, skink wrote: > > > > Archana wrote: > > Hi, my problem is similar > > to > stackoverflow.com/questions/13046872/receiving-data-fro

[android-developers] Re: Reading the headers in server after HTTP Post

2012-10-24 Thread skink
Archana wrote: > Hi, my problem is similar > to > stackoverflow.com/questions/13046872/receiving-data-from-http-post-using-sockets > > Can someone help me? > if you learned how to efficiently use google instead of asking people each time you have any problem you would find this: http://stack

[android-developers] Re: Reading the headers in server after HTTP Post

2012-10-24 Thread Archana
Hi, my problem is similar to stackoverflow.com/questions/13046872/receiving-data-from-http-post-using-sockets Can someone help me? On Wednesday, October 24, 2012 9:57:33 AM UTC+3, skink wrote: > > > > Archana wrote: > > Actually when I print using > > InputStreamReader

[android-developers] Re: Reading the headers in server after HTTP Post

2012-10-23 Thread skink
Archana wrote: > Actually when I print using > InputStreamReader isr = new > InputStreamReader(socket.getInputStream(),"utf-8"); > BufferedReader br = new BufferedReader(isr); > int b; > StringBuilder buf = new StringBuilder(); > Log.d("Before while","whil"); > while

[android-developers] Re: Reading the headers in server after HTTP Post

2012-10-23 Thread Archana
Actually when I print using InputStreamReader isr = new InputStreamReader(socket.getInputStream(),"utf-8"); BufferedReader br = new BufferedReader(isr); int b; StringBuilder buf = new StringBuilder(); Log.d("Before while","whil"); while ((b = br.read()) != -1) { b

[android-developers] Re: Reading the headers in server after HTTP Post

2012-10-23 Thread skink
Archana wrote: > Hi, when I use that, > StringWriter writer = new > StringWriter(); > IOUtils.copy(socket.getInputStream(),writer,HTTP.UTF_8); > String string = writer.toString(); > Log.d("Writer value is : ",writer.toString()); > Nothing is getting printed

[android-developers] Re: Reading the headers in server after HTTP Post

2012-10-23 Thread Archana
Hi, when I use that, StringWriter writer = new StringWriter(); IOUtils.copy(socket.getInputStream(),writer,HTTP.UTF_8); String string = writer.toString(); Log.d("Writer value is : ",writer.toString()); Nothing is getting printed in console. Can you provide

[android-developers] Re: Reading the headers in server after HTTP Post

2012-10-23 Thread skink
Archana wrote: > Hi, I did a HTTP Post from client. In server, I am able to see like, > POST /HTTP/ 1.1 > Content Length: 41 > Content-type: application/json > Host:10.0.2.15:5001 > Connection: Keep Alive > > How do I retrieve the content of JSON using socket.getInputStream()? > > Any example/hel