On Tue, 2014-03-04 at 15:36 +0000, PASSANITI Frédéric wrote:
> Hello,
>
>
>
> Is it possible to do some POST queries with nio httpcore library ?
>
Of course, it is.
> I’m using the BasicHttpRequestobject to create GET queries, but if I
> want to write/add binary content into a POST query I don’t find any
> objet or method to do it.
...
> I’m actually using the HttpAsyncRequestProducer and
> HttpAsyncResponseConsumer pattern.
>
---
HttpHost host = new HttpHost("targethost");
BasicHttpEntityEnclosingRequest request = new
BasicHttpEntityEnclosingRequest("POST", "/");
request.setEntity(new NStringEntity(
"some sort of request body", ContentType.TEXT_PLAIN));
BasicAsyncRequestProducer producer = new BasicAsyncRequestProducer(
host, request);
---
Hope this helps
Oleg
PS: If you are using HttpCore NIO for client side communication only you
might find HttpAsyncClient more convenient
http://hc.apache.org/httpcomponents-asyncclient-4.0.x/index.html
PPS: Please subscribe before posting
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]