类 JdkHttpTransport
java.lang.Object
io.agentscope.core.model.transport.JdkHttpTransport
- 所有已实现的接口:
HttpTransport
Pure JDK implementation of the HttpTransport interface.
This implementation uses JDK's built-in HttpClient (java.net.http.HttpClient) for HTTP communication and supports:
- Synchronous HTTP requests
- Server-Sent Events (SSE) streaming
- HTTP/2 with fallback to HTTP/1.1
- Connection pooling (built-in)
- Configurable timeouts
This implementation has no external dependencies beyond the JDK.
-
嵌套类概要
嵌套类 -
构造器概要
构造器构造器说明JdkHttpTransport(HttpClient client, HttpTransportConfig config) Create a new JdkHttpTransport with an existing HttpClient. -
方法概要
修饰符和类型方法说明static JdkHttpTransport.Builderbuilder()Create a new builder for JdkHttpTransport.voidclose()Close the transport and release any resources.execute(HttpRequest request) Execute a synchronous HTTP request.booleanisClosed()Check if this transport has been closed.reactor.core.publisher.Flux<String> stream(HttpRequest request) Execute a streaming HTTP request (Server-Sent Events).
-
构造器详细资料
-
JdkHttpTransport
Create a new JdkHttpTransport with an existing HttpClient.Use this constructor when you want to share an HttpClient instance across multiple components.
- 参数:
client- the HttpClient to useconfig- the transport configuration (used for reference only)- 抛出:
NullPointerException- if client or config is null
-
-
方法详细资料
-
execute
从接口复制的说明:HttpTransportExecute a synchronous HTTP request.- 指定者:
execute在接口中HttpTransport- 参数:
request- the HTTP request to execute- 返回:
- the HTTP response
- 抛出:
HttpTransportException- if the request fails
-
stream
从接口复制的说明:HttpTransportExecute a streaming HTTP request (Server-Sent Events).This method returns a Flux that emits each SSE data line as a String. The implementation should handle parsing the SSE format and extracting the data content from each event.
- 指定者:
stream在接口中HttpTransport- 参数:
request- the HTTP request to execute- 返回:
- a Flux emitting SSE data lines as strings
-
close
public void close()从接口复制的说明:HttpTransportClose the transport and release any resources.After calling this method, the transport should not be used.
- 指定者:
close在接口中HttpTransport
-
isClosed
public boolean isClosed()Check if this transport has been closed.- 返回:
- true if closed
-
builder
Create a new builder for JdkHttpTransport.- 返回:
- a new Builder instance
-