接口 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.
onRequest(int, java.util.List<com.lark.oapi.okhttp.internal.http2.Header>)onHeaders(int, java.util.List<com.lark.oapi.okhttp.internal.http2.Header>, boolean)(unless canceled)onData(int, com.lark.oapi.okio.BufferedSource, int, boolean)(optional sequence of data frames)
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.
-
字段概要
字段 -
方法概要
修饰符和类型方法说明booleanonData(int streamId, BufferedSource source, int byteCount, boolean last) A chunk of response data corresponding to a pushed request.booleanThe response headers corresponding to a pushed request.booleanDescribes the request that the server intends to push a response for.voidIndicates the reason why this stream was canceled.
-
字段详细资料
-
CANCEL
-
-
方法详细资料
-
onRequest
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
The response headers corresponding to a pushed request. Whenlastis 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
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
Indicates the reason why this stream was canceled.
-