You are here
Bee Client - A Lightweight Scala HTTP Client
- Bee Client is a Scala API that wraps the standard
java.net.URLcapability for making HTTP requests more easily.
- ...Much more easily!
It is written in Scala but may be called (a lot less easily) from Java also.
Simply create an
HttpClient instance and get / post / whatever your requests.
val httpClient = new HttpClient val response: Response = httpClient.get("http://www.google.com/") println(response.status) println(response.body.asString)
More examples follow in the tutorial.
- Simple to use - provides easy programmatic HTTP client calls, handling the necessary headers and body data.
- Light-weight - not much code; doesn't get in the way.
- Fast performance and low memory footprint.
- Easy handling of headers - both for requests and responses; both with simple values and with complex structure.
- Flexible and efficient handling of content (entity) bodies, along with the media type and character encoding. UTF-8 is used as the default character encoding.
- Request entity bodies can be streamed in. Response entity bodies can be streamed out.
- Complete implementation: all HTTP methods and headers are supported.
- Standards-compliance builds on
HttpURLConnectionand in some ways improves on it.
- HTTPS is supported (based upon
- Cookies are supported. They are held in immutable cookie jars gleaned from response headers (or created programmatically) and then sent back with subsequent requests.
- Automatic Redirection preserves cookies (unlike using
- Full awareness of proxies.
- Arbitrary multi-threading is possible because all shared state is held in immutable values.
- No additional threads are imposed - you decide what you need.
- No 'static' variables are used, so multiple configurations can co-exist within a JVM.
- Tested against a range of servers: Apache2, Nginx, Lighttpd, Cherokee, Tomcat7.
- The number of external dependencies is minimised (currently: slf4j, servlet-api).
Bee Client is nearly feature-complete. The core features are now well bedded-down and known to be reliable. Some authentication features and asynchronous support are still in development. The API is moderately stable, but there are no guarantees yet that a particular release will maintain backward compatibility. Having said that, so far, there has not been any breaking change that has been difficult to accomodate.
If you have comments about the API, improvements or other suggestions, please visit the project page and raise a ticket. Or fork it if you prefer.