接口 HttpTransport

所有已知实现类:
JdkHttpTransport, OkHttpTransport

public interface HttpTransport
HTTP transport layer interface for making HTTP requests.

This interface abstracts the actual HTTP client implementation, allowing for different implementations (OkHttp, JDK HttpClient, etc.) to be used interchangeably.

The transport layer is responsible for:

  • Executing synchronous HTTP requests
  • Handling streaming (SSE) responses
  • Managing connection lifecycle
  • 方法概要

    修饰符和类型
    方法
    说明
    void
    Close the transport and release any resources.
    Execute a synchronous HTTP request.
    reactor.core.publisher.Flux<String>
    Execute a streaming HTTP request (Server-Sent Events).
  • 方法详细资料

    • execute

      Execute a synchronous HTTP request.
      参数:
      request - the HTTP request to execute
      返回:
      the HTTP response
      抛出:
      HttpTransportException - if the request fails
    • stream

      reactor.core.publisher.Flux<String> stream(HttpRequest request)
      Execute 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.

      参数:
      request - the HTTP request to execute
      返回:
      a Flux emitting SSE data lines as strings
    • close

      void close()
      Close the transport and release any resources.

      After calling this method, the transport should not be used.