-
Notifications
You must be signed in to change notification settings - Fork 0
Home
NanoHTTP is simple, easy-to-use, lightweight HTTP Client for Java 8.
Traditionally, if you wanted to do an HTTP call in Java, you had to use the HttpURLConnection class in the java.net package. Unfortunately HttpURLConnection is a low-level API that is unintuitive at best and downright awful at worst. The resulting code is cumbersome and hard to understand. If you’re wondering what a nightmare the API is, see this StackOverflow post. NanoHTTP solves this by wrapping HttpURLConnection in a user friendly API.
In this wiki we try to provide a readable user guide with some simple examples to demonstrate the most common features of NanoHTTP.
- Easy to use for common cases
- A simple, concise, and user-friendly API which caters to 90 percent of application needs
- Java 8 or higher (Java 8 is still the most used version of the JDK)
- No dependencies (other than the JDK)
- Support for "Basic" HTTP authentication scheme
- Transparent GZip/Deflate support for HTTP responses
- GZip encoding for HTTP PUT and POST requests
- Support
application/x-www-form-urlencoded
content - Support for
multipart/form-data
content - Intuitive error handling
- And more...
It's true that there are more than several HTTP Client libraries flowing around the Java ecosystem. But there are several features that make NanoHTTP unique.
Since NanoHTTP closely matches the behavior of HttpURLConnection, it is ideal for users who are aware of or written code with HttpURLConnection idiosyncrasies in mind. And did I mention zero dependencies?