8000 ApacheHttpTransport uses deprecated APIs and cannot be used with recommended HttpClient APIs · Issue #503 · googleapis/google-http-java-client · GitHub
[go: up one dir, main page]

Skip to content 8000
ApacheHttpTransport uses deprecated APIs and cannot be used with recommended HttpClient APIs #503
Closed
@hiranya911

Description

@hiranya911

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.

Metadata

Metadata

Assignees

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0