I am currenty using Apache’s HttpComponents including the HttpAsyncClient beta, but I was wondering. How do I set the headers for a HttpAsyncPost?
I currently have:
HttpAsyncPost asyncRequest = new HttpAsyncPost(channel, "id=15846");
But how do I set the headers for this request?
You could use
HttpAsyncMethods#createmethod in order to create anHttpAsyncRequestProducerfrom an arbitraryHttpUriRequestinstance, if you do not mind upgrading to the latest snapshot.Alternatively, you can override
HttpAsyncPost#createRequest()method and add custom headers to theHttpEntityEnclosingRequestinstance returned by the super class.Hope this helps.