Package org.a2aproject.sdk.client.http
Class JdkA2AHttpClient
java.lang.Object
org.a2aproject.sdk.client.http.JdkA2AHttpClient
- All Implemented Interfaces:
A2AHttpClient
Default HTTP client implementation using JDK 11+
HttpClient.
This is the fallback implementation used when no higher-priority
A2AHttpClientProvider is available. It provides full support for:
- HTTP/2 with automatic fallback to HTTP/1.1
- Synchronous GET, POST, and DELETE requests
- Asynchronous Server-Sent Events (SSE) streaming
- Automatic redirect following
Provider Priority: 0 (lowest - used as fallback)
This implementation is registered via JdkA2AHttpClientProvider
in the ServiceLoader system and is automatically used by A2AHttpClientFactory
when no other provider is available.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.a2aproject.sdk.client.http.A2AHttpClient
A2AHttpClient.Builder<T extends A2AHttpClient.Builder<T>>, A2AHttpClient.DeleteBuilder, A2AHttpClient.GetBuilder, A2AHttpClient.PostBuilder -
Field Summary
Fields inherited from interface org.a2aproject.sdk.client.http.A2AHttpClient
ACCEPT, APPLICATION_JSON, CONTENT_TYPE, EVENT_STREAM -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new JDK-based HTTP client.JdkA2AHttpClient(HttpClient httpClient) Creates a new JDK-based HTTP client using a caller-provided JDKHttpClient. -
Method Summary
Modifier and TypeMethodDescriptionCreates a builder for DELETE requests.Creates a builder for GET requests.Creates a builder for POST requests.
-
Constructor Details
-
JdkA2AHttpClient
public JdkA2AHttpClient()Creates a new JDK-based HTTP client.Configures the client with:
- HTTP/2 preferred (with HTTP/1.1 fallback)
- Normal redirect following
-
JdkA2AHttpClient
Creates a new JDK-based HTTP client using a caller-provided JDKHttpClient.- Parameters:
httpClient- the JDK HTTP client to delegate requests to- Throws:
IllegalArgumentException- ifhttpClientisnull
-
-
Method Details
-
createGet
Description copied from interface:A2AHttpClientCreates a builder for GET requests.- Specified by:
createGetin interfaceA2AHttpClient- Returns:
- a new GetBuilder instance
-
createPost
Description copied from interface:A2AHttpClientCreates a builder for POST requests.- Specified by:
createPostin interfaceA2AHttpClient- Returns:
- a new PostBuilder instance
-
createDelete
Description copied from interface:A2AHttpClientCreates a builder for DELETE requests.- Specified by:
createDeletein interfaceA2AHttpClient- Returns:
- a new DeleteBuilder instance
-