Closed
Description
ApacheHttpTransport
class uses many deprecated APIs from Apache HTTP Client. There are around 75 deprecation warnings in that class alone.
Moreover, it is now impossible to use the ApacheHttpTransport
with a recommended implementation of Apache HttpClient. For instance, the following doesn't work:
import org.apache.http.impl.client.HttpClients;
public void testDefaultClient() {
new ApacheHttpTransport(HttpClients.createDefault());
}
The above fails with the following error:
java.lang.UnsupportedOperationException
at org.apache.http.impl.client.InternalHttpClient.getParams(InternalHttpClient.java:211)
at com.google.api.client.http.apache.ApacheHttpTransport.<init>(ApacheHttpTransport.java:127)
at com.google.api.client.http.apache.ApacheHttpTransportTest.testDefaultClient(ApacheHttpTransportTest.java:98)
This is because new HttpClient
implementations do not expose their HttpParams
and ConnectionManager
(both these getters have been deprecated, and most default implementations now throw errors).
Realistically one can only use ApacheHttpTransport
with DefaultHttpClient
, which itself is a deprecated API now.