A Simple Java Http Client
I recently needed to make an HTTP call from my AppEngine application, which uses the standard java.net classes for its urlFetch service. Doing something as simple as an HTTP request in Java is a lot more complicated than one would hope. Since I didn't find the process intuitive at all, I wrote this little Java HTTP client that works the way I think of HTTP. Along the way I got to experiment with generics, which allowed me to make chained method calls so I can effectively make the whole HTTP request and get the response in one line of code (sort of). The whole client consists of three classes and uses only core java classes, so no external libraries are needed (and it can run on AppEngine). Message.java This class forms the basis for the Request and Response classes. Message is an abstract class, and contains only those things that are common to both Requests and Responses, e.g. headers and a body. Request.java This class does most of the heavy lifting. It contains