Package org.a2aproject.sdk.client.http
Interface A2AHttpClient.GetBuilder
- All Superinterfaces:
A2AHttpClient.Builder<A2AHttpClient.GetBuilder>
- Enclosing interface:
- A2AHttpClient
public static interface A2AHttpClient.GetBuilder
extends A2AHttpClient.Builder<A2AHttpClient.GetBuilder>
Builder for HTTP GET requests.
Supports both synchronous requests and asynchronous Server-Sent Events (SSE) streaming.
-
Method Summary
Modifier and TypeMethodDescriptiondefault A2AHttpClient.GetBuilderfollowRedirects(boolean follow) Controls whether the HTTP client follows at most one redirect for this synchronous GET request.get()Executes a synchronous GET request.getAsyncSSE(Consumer<ServerSentEvent> messageConsumer, Consumer<Throwable> errorConsumer, Runnable completeRunnable) Executes an asynchronous GET request expecting Server-Sent Events (SSE).Methods inherited from interface org.a2aproject.sdk.client.http.A2AHttpClient.Builder
addHeader, addHeaders, url
-
Method Details
-
followRedirects
Controls whether the HTTP client follows at most one redirect for this synchronous GET request. When set totrue, the SDK issues a follow-up GET to theLocationURL with headers filtered byRedirectHeaderPolicyto prevent credential leakage.getAsyncSSEis never redirected regardless of this flag.Note for implementors: The default implementation is a no-op. Third-party
A2AHttpClientimplementations MUST override this method to honour the setting.- Parameters:
follow-trueto follow one redirect hop,falseto disable (default)- Returns:
- this builder for chaining
-
get
Executes a synchronous GET request.- Returns:
- the HTTP response
- Throws:
IOException- if an I/O error occursInterruptedException- if the operation is interrupted
-
getAsyncSSE
CompletableFuture<Void> getAsyncSSE(Consumer<ServerSentEvent> messageConsumer, Consumer<Throwable> errorConsumer, Runnable completeRunnable) throws IOException, InterruptedException Executes an asynchronous GET request expecting Server-Sent Events (SSE).The request will stream SSE messages asynchronously, invoking the provided consumers for each event, error, or completion.
- Parameters:
messageConsumer- callback for each SSE message receivederrorConsumer- callback for errors during streamingcompleteRunnable- callback when the stream completes normally- Returns:
- a CompletableFuture that completes when streaming ends
- Throws:
IOException- if an I/O error occursInterruptedException- if the operation is interrupted
-