Tag Archives: commons httpclient

Apache HttpClient 4 Custom Bytes ResponseHandler

An interesting thing I needed was to retrieve an image from a URL. HttpClient provides a BasicResponseHandler, which returns a String. I needed bytes in order to accomplish this, I had to implement my own response handler. Advertisements

Posted in Java | Tagged , , , , , | 1 Comment

Apache HttpClient 4 JSON post example with a generic method

In a previous post HttpClient 4 Json Post I showed how to post a Json object to a URL. That was useful, but required writing a method for each type of object you needed posted. A cleaner way is to … Continue reading

Posted in Java | Tagged , , , , , , , | Leave a comment

Apache HttpClient 4 JSON post example

Posting JSON to a URL is a common use case. Here is a follow-on to HttpClient Post for a String. Line 13 and 14 convert the object to be posted into a Json string and set it as the payload … Continue reading

Posted in Java | Tagged , , , , | 1 Comment