public static interface FrameReader.Handler
Modifier and Type | Method and Description |
---|---|
void |
ackSettings()
HTTP/2 only.
|
void |
alternateService(int streamId,
String origin,
okio.ByteString protocol,
String host,
int port,
long maxAge)
HTTP/2 only.
|
void |
data(boolean inFinished,
int streamId,
okio.BufferedSource source,
int length) |
void |
goAway(int lastGoodStreamId,
ErrorCode errorCode,
okio.ByteString debugData)
The peer tells us to stop creating streams.
|
void |
headers(boolean outFinished,
boolean inFinished,
int streamId,
int associatedStreamId,
List<Header> headerBlock,
HeadersMode headersMode)
Create or update incoming headers, creating the corresponding streams
if necessary.
|
void |
ping(boolean ack,
int payload1,
int payload2)
Read a connection-level ping from the peer.
|
void |
priority(int streamId,
int streamDependency,
int weight,
boolean exclusive)
Called when reading a headers or priority frame.
|
void |
pushPromise(int streamId,
int promisedStreamId,
List<Header> requestHeaders)
HTTP/2 only.
|
void |
rstStream(int streamId,
ErrorCode errorCode) |
void |
settings(boolean clearPrevious,
Settings settings) |
void |
windowUpdate(int streamId,
long windowSizeIncrement)
Notifies that an additional
windowSizeIncrement bytes can be
sent on streamId , or the connection if streamId is zero. |
void data(boolean inFinished, int streamId, okio.BufferedSource source, int length) throws IOException
IOException
void headers(boolean outFinished, boolean inFinished, int streamId, int associatedStreamId, List<Header> headerBlock, HeadersMode headersMode)
outFinished
- true if the receiver should not send further frames.inFinished
- true if the sender will not send further frames.streamId
- the stream owning these headers.associatedStreamId
- the stream that triggered the sender to create
this stream.void rstStream(int streamId, ErrorCode errorCode)
void settings(boolean clearPrevious, Settings settings)
void ackSettings()
void ping(boolean ack, int payload1, int payload2)
ack
indicates this
is a reply. Payload parameters are different between SPDY/3 and HTTP/2.
In SPDY/3, only the first payload1
parameter is set. If the
reader is a client, it is an unsigned even number. Likewise, a server
will receive an odd number.
In HTTP/2, both payload1
and payload2
parameters are
set. The data is opaque binary, and there are no rules on the content.
void goAway(int lastGoodStreamId, ErrorCode errorCode, okio.ByteString debugData)
ID > lastGoodStreamId
on a new connection. In-
flight streams with ID <= lastGoodStreamId
can only be replayed
on a new connection if they are idempotent.lastGoodStreamId
- the last stream ID the peer processed before
sending this message. If lastGoodStreamId
is zero, the peer
processed no frames.errorCode
- reason for closing the connection.debugData
- only valid for HTTP/2; opaque debug data to send.void windowUpdate(int streamId, long windowSizeIncrement)
windowSizeIncrement
bytes can be
sent on streamId
, or the connection if streamId
is zero.void priority(int streamId, int streamDependency, int weight, boolean exclusive)
streamId
- stream which has a priority change.streamDependency
- the stream ID this stream is dependent on.weight
- relative proportion of priority in [1..256].exclusive
- inserts this stream ID as the sole child of
streamDependency
.void pushPromise(int streamId, int promisedStreamId, List<Header> requestHeaders) throws IOException
A push promise contains all the headers that pertain to a server-initiated
request, and a promisedStreamId
to which response frames will be
delivered. Push promise frames are sent as a part of the response to
streamId
.
streamId
- client-initiated stream ID. Must be an odd number.promisedStreamId
- server-initiated stream ID. Must be an even
number.requestHeaders
- minimally includes :method
, :scheme
,
:authority
, and (@code :path}.IOException
void alternateService(int streamId, String origin, okio.ByteString protocol, String host, int port, long maxAge)
See alt-svc
streamId
- when a client-initiated stream ID (odd number), the
origin of this alternate service is the origin of the stream. When
zero, the origin is specified in the origin
parameter.origin
- when present, the
origin is typically
represented as a combination of scheme, host and port. When empty,
the origin is that of the streamId
.protocol
- an ALPN protocol, such as h2
.host
- an IP address or hostname.port
- the IP port associated with the service.maxAge
- time in seconds that this alternative is considered fresh.Copyright © 2017. All Rights Reserved.