Interface FrameReader.Handler

  • Enclosing interface:
    FrameReader


    public static interface FrameReader.Handler
    • Method Summary

      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.
    • Method Detail

      • data

        void data(boolean inFinished,
                  int streamId,
                  okio.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. 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.

      • goAway

        void goAway(int lastGoodStreamId,
                    ErrorCode errorCode,
                    okio.ByteString debugData)
        The peer tells us to stop creating streams. It is safe to replay streams with ID > lastGoodStreamId on a new connection. In- flight streams with ID <= lastGoodStreamId can only be replayed on a new connection if they are idempotent.
        Parameters:
        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.
      • windowUpdate

        void windowUpdate(int streamId,
                          long windowSizeIncrement)
        Notifies that an additional windowSizeIncrement bytes can be sent on streamId, or the connection if streamId is 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 of streamDependency.
      • pushPromise

        void pushPromise(int streamId,
                         int promisedStreamId,
                         List<Header> requestHeaders)
                  throws IOException
        HTTP/2 only. Receive a push promise header block.

        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.

        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,
                              okio.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 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.