Tag Archives: httpclient

Apache HttpClient 4 byte handling

After I wrote my own HttpClient ResponseHandler in Apache HttpClient 4 Custom Bytes ResponseHandler, I discovered that there might be a better way. I had used the following utility to get the bytes. I found that one of their classes … Continue reading

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

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.

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

Apache HttpClient 4 String post example

Continuing from my Http Get Example, here is an example of an HttpClient4 String post example.

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

Apache HttpClient 4 String get example

This was an older piece of code that I had. Add the following dependency. I made a wrapper method that performs a get of a given URL and returns a string.

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