Class RestTransportConfig
java.lang.Object
org.a2aproject.sdk.client.transport.spi.ClientTransportConfig<RestTransport>
org.a2aproject.sdk.client.transport.rest.RestTransportConfig
Configuration for the REST transport protocol.
This configuration class allows customization of the HTTP client used for RESTful communication with A2A agents. If no HTTP client is specified, the default JDK-based implementation is used.
Basic usage:
// Use default HTTP client
RestTransportConfig config = new RestTransportConfigBuilder()
.build();
Client client = Client.builder(agentCard)
.withTransport(RestTransport.class, config)
.build();
Custom HTTP client:
// Custom HTTP client with timeouts
A2AHttpClient customClient = new CustomHttpClient()
.withConnectTimeout(Duration.ofSeconds(10))
.withReadTimeout(Duration.ofSeconds(30));
RestTransportConfig config = new RestTransportConfigBuilder()
.httpClient(customClient)
.build();
With interceptors:
RestTransportConfig config = new RestTransportConfigBuilder()
.httpClient(customClient)
.addInterceptor(new LoggingInterceptor())
.addInterceptor(new AuthInterceptor("Bearer token"))
.build();
- See Also:
-
Field Summary
Fields inherited from class ClientTransportConfig
interceptors, parameters -
Constructor Summary
ConstructorsConstructorDescriptionCreate a REST transport configuration with the default HTTP client.RestTransportConfig(A2AHttpClient httpClient) Create a REST transport configuration with a custom HTTP client. -
Method Summary
Methods inherited from class ClientTransportConfig
getInterceptors, getParameters, setInterceptors, setParameters
-
Constructor Details
-
RestTransportConfig
public RestTransportConfig()Create a REST transport configuration with the default HTTP client.The default JDK-based HTTP client will be used. Consider using
RestTransportConfigBuilderinstead for a more fluent API. -
RestTransportConfig
Create a REST transport configuration with a custom HTTP client.Consider using
RestTransportConfigBuilderinstead for a more fluent API.- Parameters:
httpClient- the HTTP client to use for REST requests
-
-
Method Details
-
getHttpClient
Get the configured HTTP client.- Returns:
- the HTTP client, or
nullif using the default
-