URL parameters and post body in the same Apache httpclient request?
I usually use this:
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost(postURL);
...
HttpResponse responsePOST = client.execute(post);
Is it possible to pass parameters in a combination of GET and POST in the same request? I mean some parameters might be pretty lon开发者_JS百科g... and I dont want to use GET, I want POST, but to some I do want the GET.
So?
GET and POST are mutually exclusive, you do one or the other (or HEAD, PUT etc). A request cannot be both.
A single HTTP request, according to the protocol, is either GET or POST. There is no way to construct an HTTP header for both at the same time.
However
A POST request be directed to a URL with query parameters (the stuff after the ?) and the server can read them.
a GET request can have content, and the server can read it.
精彩评论