-
public interface PushObserverHTTP/2 only. Processes server-initiated HTTP requests on the client. Implementations must quickly dispatch callbacks to avoid creating a bottleneck.
While onReset 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.
-
-
Method Summary
Modifier and Type Method Description abstract booleanonRequest(int streamId, List<Header> requestHeaders)Describes the request that the server intends to push a response for. abstract booleanonHeaders(int streamId, List<Header> responseHeaders, boolean last)The response headers corresponding to a pushed request. abstract booleanonData(int streamId, BufferedSource source, int byteCount, boolean last)A chunk of response data corresponding to a pushed request. abstract voidonReset(int streamId, ErrorCode errorCode)Indicates the reason why this stream was canceled. -
-
Method Detail
-
onRequest
abstract boolean onRequest(int streamId, List<Header> requestHeaders)
Describes the request that the server intends to push a response for.
- Parameters:
streamId- server-initiated stream ID: an even number.requestHeaders- minimally includes{@code :method},{@code :scheme},{@code :authority},and{@code :path}.
-
onHeaders
abstract boolean onHeaders(int streamId, List<Header> responseHeaders, boolean last)
The response headers corresponding to a pushed request. When
{@code last}is true, there areno data frames to follow.- Parameters:
streamId- server-initiated stream ID: an even number.responseHeaders- minimally includes{@code :status}.last- when true, there is no response data.
-
onData
abstract boolean onData(int streamId, BufferedSource source, int byteCount, boolean last)
A chunk of response data corresponding to a pushed request. This data must either be read orskipped.
- Parameters:
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.
-
-
-
-