eclipse-ee4j / eclipse-ee4j/jersey

The org.glassfish.jersey.apache.connector.ApacheConnector cannot be fully configured (e.g., retry handler) because the HttpClient is not accessible.

Open
#2,411 13 comments 0 reactions 0 assignees View on GitHub
Component: connectors Priority: Major Type: Improvement
Dominant language
Java
Stars
730
Forks
382
PR merge metrics
No merged PRs in 30d

Description

The ApacheConnector API has a design omission in that it does not allow the user to create and provide a configured HttpClient. In Jersey 1.7.x we were able to create an HttpClient, assign a retry handler directly, and provide the HttpClient to the Jersey client to use.

In Jersey 2.3.1, the ApacheConnector creates the HttpClient (a deprecated version of it) that the user cannot modify. The user can retrieve said client, but the HttpClient interface does not expose a configure it, it's essentially immutable. To make matters worse, this version of Jersey depends on httpclient 4.2.5 rather than 4.3\. There have been many important changes and deprecations in 4.3 which impact the ApacheConnector design.

A good fix would be to provide an additional constructor ApacheConnector(HttpClient httpclient, Configuration config). I would also strongly recommend upgrading to depend on httpclient 4.3, removing deprecations, and refactoring as necessary.
#### Affected Versions
[2.3.1, 2.4]

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.