سؤال

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

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top