[improve][client] Implement HTTP client using javax.ws.rs #23905
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
I encountered an issue when using Kerberos and TLS transport to connect to the broker. The
pulsar-admin
andpulsar-client
(for HTTP lookup) failed to work as expected.In the
org.apache.pulsar.client.impl.auth.AuthenticationSasl#authenticationStage
method, the broker requests should use theWebTarget
provided by thepulsar-admin
orpulsar-client
HTTP clients. However, the current implementation creates a new HTTP client to construct theWebTarget
, causing the TLS context to be lost.Currently, the
pulsar-admin
HTTP client is built onjavax.ws.rs
and AHC (Async Http Client), while thepulsar-client
HTTP client relies only on AHC. To resolve this inconsistency and maintain the TLS context, we need to refactor thepulsar-client
to provide the requiredWebTarget
.Modifications
Package Changes:
org.apache.pulsar.client.admin.internal.http
toorg.apache.pulsar.client.internal.http
.pulsar-client-admin
topulsar-client
.Refactored HTTP Client:
HttpClient.java
to useAsyncHttpConnectorProvider
andAsyncHttpConnector
for a unified and consistent implementation.Fixed Client Calls:
pulsar-client
calls to utilize the refactored HTTP client.Documentation
doc
doc-required
doc-not-needed
doc-complete