Interface FrameReader.Handler
-
- Enclosing interface:
- FrameReader
public static interface FrameReader.Handler
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidackSettings()HTTP/2 only.voidalternateService(int streamId, String origin, ByteString protocol, String host, int port, long maxAge)HTTP/2 only.voiddata(boolean inFinished, int streamId, BufferedSource source, int length)voidgoAway(int lastGoodStreamId, ErrorCode errorCode, ByteString debugData)The peer tells us to stop creating streams.voidheaders(boolean outFinished, boolean inFinished, int streamId, int associatedStreamId, List<Header> headerBlock, HeadersMode headersMode)Create or update incoming headers, creating the corresponding streams if necessary.voidping(boolean ack, int payload1, int payload2)Read a connection-level ping from the peer.voidpriority(int streamId, int streamDependency, int weight, boolean exclusive)Called when reading a headers or priority frame.voidpushPromise(int streamId, int promisedStreamId, List<Header> requestHeaders)HTTP/2 only.voidrstStream(int streamId, ErrorCode errorCode)voidsettings(boolean clearPrevious, Settings settings)voidwindowUpdate(int streamId, long windowSizeIncrement)Notifies that an additionalwindowSizeIncrementbytes can be sent onstreamId, or the connection ifstreamIdis zero.
-
-
-
Method Detail
-
data
void data(boolean inFinished, int streamId, BufferedSource source, int length) throws IOException- Throws:
IOException
-
headers
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. Frames that trigger this are SPDY SYN_STREAM, HEADERS, and SYN_REPLY, and HTTP/2 HEADERS and PUSH_PROMISE.- Parameters:
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.
-
rstStream
void rstStream(int streamId, ErrorCode errorCode)
-
settings
void settings(boolean clearPrevious, Settings settings)
-
ackSettings
void ackSettings()
HTTP/2 only.
-
ping
void ping(boolean ack, int payload1, int payload2)Read a connection-level ping from the peer.ackindicates this is a reply. Payload parameters are different between SPDY/3 and HTTP/2.In SPDY/3, only the first
payload1parameter 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
payload1andpayload2parameters are set. The data is opaque binary, and there are no rules on the content.
-
goAway
void goAway(int lastGoodStreamId, ErrorCode errorCode, ByteString debugData)The peer tells us to stop creating streams. It is safe to replay streams withID > lastGoodStreamIdon a new connection. In- flight streams withID <= lastGoodStreamIdcan only be replayed on a new connection if they are idempotent.- Parameters:
lastGoodStreamId- the last stream ID the peer processed before sending this message. IflastGoodStreamIdis zero, the peer processed no frames.errorCode- reason for closing the connection.debugData- only valid for HTTP/2; opaque debug data to send.
-
windowUpdate
void windowUpdate(int streamId, long windowSizeIncrement)Notifies that an additionalwindowSizeIncrementbytes can be sent onstreamId, or the connection ifstreamIdis zero.
-
priority
void priority(int streamId, int streamDependency, int weight, boolean exclusive)Called when reading a headers or priority frame. This may be used to change the stream's weight from the default (16) to a new value.- Parameters:
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 ofstreamDependency.
-
pushPromise
void pushPromise(int streamId, int promisedStreamId, List<Header> requestHeaders) throws IOExceptionHTTP/2 only. Receive a push promise header block.A push promise contains all the headers that pertain to a server-initiated request, and a
promisedStreamIdto which response frames will be delivered. Push promise frames are sent as a part of the response tostreamId.- Parameters:
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}.- Throws:
IOException
-
alternateService
void alternateService(int streamId, String origin, ByteString protocol, String host, int port, long maxAge)HTTP/2 only. Expresses that resources for the connection or a client- initiated stream are available from a different network location or protocol configuration.See alt-svc
- Parameters:
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 theoriginparameter.origin- when present, the origin is typically represented as a combination of scheme, host and port. When empty, the origin is that of thestreamId.protocol- an ALPN protocol, such ash2.host- an IP address or hostname.port- the IP port associated with the service.maxAge- time in seconds that this alternative is considered fresh.
-
-