a2aproject / a2aproject/a2a-java

[Feat]: Add Android support for A2A HTTP Client and decouple JdkA2AHttpClient (v0.3.x)

未關閉
#793 12 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Java
星號
490
分支
172
平均合併
1 天 6 小時
30 天內合併 PR
55

描述

### Is your feature request related to a problem? Please describe.

## Problem

Currently, the A2A Java SDK hardcodes the use of `JdkA2AHttpClient` in several places (such as `A2A.java` and various transport providers). This client relies on `java.net.http.HttpClient`, which is not available in standard Android environments, making the SDK unusable on Android.
Additionally, when running on Android, Jackson fails to deserialize Java records properly without explicit property annotations, leading to parsing errors for spec models.

### Describe the solution you'd like

## Proposed Solution

- **SPI Pattern**: Introduce `A2AHttpClientFactory` and `A2AHttpClientProvider` using Java's `ServiceLoader` (SPI) to dynamically load the best HTTP client available on the classpath.
- **Android Client**: Implement `AndroidA2AHttpClient` using `HttpURLConnection` (which is safe for Android).
- **Jackson Fixes**: Add `@JsonProperty` annotations to records in the `spec/` module to ensure they can be parsed on Android.

### Describe alternatives you've considered

_No response_

### Additional context

## Goal

The goal is to make the `http-client` module compatible with Android by:
1. Decoupling the HTTP client implementation so it is not hardcoded to the JDK client.
2. Providing an Android-compatible HTTP client implementation.
3. Fixing the Jackson parsing issues for records on Android.

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。