Question

In my class DeviceHandler I want to know the HTTP request method used; I don't understand how with my HttpRequest object ?

public class DeviceHandler implements HttpRequestHandler {

...

public void handle(HttpRequest request, HttpResponse response,
                        HttpContext httpContext) throws HttpException,
                                                IOException {

// I want to dispatch the treatment according GET or POST request received from my client

Thank you guys !

Anthony

Was it helpful?

Solution

Here is documentation

http://developer.android.com/reference/org/apache/http/HttpRequest.html

use

RequestLine rl = request.getRequestLine();

to retrieve RequestLine instance, then you can call

String m = rl.getMethod();

to get method of request.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top