JsonRpcTransportWrapper
public class JsonRpcTransportWrapper implements TransportWrapper<String, Object>
io/agentscope/core/a2a/server/transport/jsonrpc/JsonRpcTransportWrapper.java:77–253包装器用于 JSON-RPC 传输层请求。位于 io.agentscope.core.a2a.server.transport.jsonrpc 包,实现 TransportWrapper<String, Object>。核心成员包括 getTransportType、handleRequest、JsonRpcTransportWrapper。
The Wrapper for JSON-RPC transport request.
wrapper all JSON-RPC request pre-handle logic, developer should get string body and some headers and metadata from request.
The pre-handle logic with:
-
deserialize request body to JSON-RPC request.
-
judge whether the request is streaming request.
-
build
io.a2a.server.ServerCallContextfrom JSON-RPC method, headers and all metadata. -
handle error and exception for JSON-RPC request handle.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public JsonRpcTransportWrapper(JSONRPCHandler jsonrpcHandler) | 初始化 `JsonRpcTransportWrapper` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public String getTransportType() | 获取传输层类型。 Returns the transport type. |
public Object handleRequest(String body, Map<String, String> headers, Map<String, Object> metadata) | 处理请求。 Do handle for JSON-RPC Request, including streaming and non-streaming request. |
构造器详情Constructor Detail
JsonRpcTransportWrapper
public JsonRpcTransportWrapper(JSONRPCHandler jsonrpcHandler)
初始化 JsonRpcTransportWrapper 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
jsonrpcHandler | JSONRPCHandler | jsonrpc 处理器(类型 `JSONRPCHandler`)。The jsonrpc handler. |
io/agentscope/core/a2a/server/transport/jsonrpc/JsonRpcTransportWrapper.java:93–95方法详情Method Detail
getTransportType
public String getTransportType()
获取传输层类型。
Returns the transport type.
Stringio/agentscope/core/a2a/server/transport/jsonrpc/JsonRpcTransportWrapper.java:97–100handleRequest
public Object handleRequest(String body, Map<String, String> headers, Map<String, Object> metadata)
处理请求。
Do handle for JSON-RPC Request, including streaming and non-streaming request.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
body | String | 正文(类型 `String`)。JSON-RPC request body string |
headers | Map<String, String> | 请求头(类型 `Map`)。JSON-RPC request headers map |
metadata | Map<String, Object> | 元数据(类型 `Map`)。Other JSON-RPC request metadata from request or developer. |
Objectio/agentscope/core/a2a/server/transport/jsonrpc/JsonRpcTransportWrapper.java:112–135