OkHttp exposes three APIs:
- Request/Response. This is the most fully-featured API. It can be used synchronously or asynchronously. It avoids mutable state. Plus interceptors!
- OkUrlFactory, the HttpURLConnection API. This is a complete implementation of an awkward API. The API’s awkardness has resulted in an implementation that is complex and fragile.
- The Apache HTTP client shim. This is intended to simplify migration. It’s a partial implementation; some methods throw
UnsupportedOperationException
when invoked.
In OkHttp 3.0, we’re deprecating both OkUrlFactory
and Apache HTTP client shim. And we’ll be deleting them in a follow-up release.
If you’re using the Request/Response API, this is good news. It means we’ll be able to significantly simplify the OkHttp internals yielding better performance and stability.
If you’re using OkUrlFactory
this is good news. Finally an excuse to shed some of your own tech debt and adopt a better API. Did I mention interceptors?! If for whatever reason you can’t upgrade, you’ll need to rely on the platform’s built-in HttpURLConnection
going forward.
And if you’re on the Apache HTTP client shim, this is merely annoying. You can make your own shim by forking ours. Unlike HttpUrlConnection
, the shim can be implemented on top of OkHttp’s public APIs.
We’re building OkHttp to make the best Android apps even better. And sometimes that means leaving the old stuff behind.