Wednesday, December 12, 2012

Re: [android-developers] Re: Identifying HTTP Get requests in Android

This is nothing Android specific.

Designing HTTP servers that follow this pattern is a common Java
problem, but in my mind there is no reason that you should be doing
this on Android. Instead you should be communicating with your
service using messages to and from a service using a smart mechanism
(GCM) to talk back to your apps.

HTTP servers will kill the battery...

But if you insist that your app is special, the common pattern is to
have a dedicated thread that handles the connection and forks off
worker threads to handle incoming requests, this is the common case.

Is there any reason you'd want truly non blocking I/O? But the answer
is Java nio, which Android *does* include:

http://developer.android.com/reference/java/nio/package-summary.html

http://blog.codepainters.com/2012/02/17/why-java-nio-is-a-better-idea-for-android/

Kris

On Wed, Dec 12, 2012 at 8:27 AM, Archana <ramalingam.archana@gmail.com> wrote:
> Hi,
>
> I used request.getRequestLine().getMethod(); that tells me if the method is
> GET/DELETE/POST and handle it accordingly. Any idea of how can I make my
> HTTP server in the Android phone non-blocking? I mean to simultaneously
> handle POST, GET and DELETE requests ?
>
> Thank you!
>
>
> On Tuesday, December 4, 2012 12:58:42 PM UTC+2, skink wrote:
>>
>>
>>
>> Archana wrote:
>> > Hi,
>> >
>> > is it using HttpService.handleRequest? Please help as I dont have much
>> > idea of using HTTP Core.
>> >
>> >
>>
>> i have not used HttpService so cant help much
>>
>> pskink
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

No comments:

Post a Comment