接口 PushObserver


public interface PushObserver
HTTP/2 only. Processes server-initiated HTTP requests on the client. Implementations must quickly dispatch callbacks to avoid creating a bottleneck.

While onReset(int, com.lark.oapi.okhttp.internal.http2.ErrorCode) may occur at any time, the following callbacks are expected in order, correlated by stream ID.

As a stream ID is scoped to a single HTTP/2 connection, implementations which target multiple connections should expect repetition of stream IDs.

Return true to request cancellation of a pushed stream. Note that this does not guarantee future frames won't arrive on the stream ID.

  • 字段概要

    字段
    修饰符和类型
    字段
    说明
    static final PushObserver
     
  • 方法概要

    修饰符和类型
    方法
    说明
    boolean
    onData(int streamId, BufferedSource source, int byteCount, boolean last)
    A chunk of response data corresponding to a pushed request.
    boolean
    onHeaders(int streamId, List<Header> responseHeaders, boolean last)
    The response headers corresponding to a pushed request.
    boolean
    onRequest(int streamId, List<Header> requestHeaders)
    Describes the request that the server intends to push a response for.
    void
    onReset(int streamId, ErrorCode errorCode)
    Indicates the reason why this stream was canceled.
  • 字段详细资料

  • 方法详细资料

    • onRequest

      boolean onRequest(int streamId, List<Header> requestHeaders)
      Describes the request that the server intends to push a response for.
      参数:
      streamId - server-initiated stream ID: an even number.
      requestHeaders - minimally includes :method, :scheme, :authority, and :path.
    • onHeaders

      boolean onHeaders(int streamId, List<Header> responseHeaders, boolean last)
      The response headers corresponding to a pushed request. When last is true, there are no data frames to follow.
      参数:
      streamId - server-initiated stream ID: an even number.
      responseHeaders - minimally includes :status.
      last - when true, there is no response data.
    • onData

      boolean onData(int streamId, BufferedSource source, int byteCount, boolean last) throws IOException
      A chunk of response data corresponding to a pushed request. This data must either be read or skipped.
      参数:
      streamId - server-initiated stream ID: an even number.
      source - location of data corresponding with this stream ID.
      byteCount - number of bytes to read or skip from the source.
      last - when true, there are no data frames to follow.
      抛出:
      IOException
    • onReset

      void onReset(int streamId, ErrorCode errorCode)
      Indicates the reason why this stream was canceled.