Pregunta

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

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top