Class HTTP2ServerConnectionFactory.HTTPServerSessionListener

java.lang.Object
org.eclipse.jetty.http2.api.Session.Listener.Adapter
org.eclipse.jetty.http2.api.server.ServerSessionListener.Adapter
org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory.HTTPServerSessionListener
All Implemented Interfaces:
ServerSessionListener, Session.Listener, Stream.Listener
Enclosing class:
HTTP2ServerConnectionFactory

protected class HTTP2ServerConnectionFactory.HTTPServerSessionListener extends ServerSessionListener.Adapter implements Stream.Listener
  • Constructor Details

    • HTTPServerSessionListener

      public HTTPServerSessionListener(Connector connector, EndPoint endPoint)
  • Method Details

    • getConnection

      protected HTTP2ServerConnection getConnection()
    • onPreface

      public Map<Integer,Integer> onPreface(Session session)
      Description copied from interface: Session.Listener

      Callback method invoked:

      • for clients, just before the preface is sent, to gather the SETTINGS configuration options the client wants to send to the server;
      • for servers, just after having received the preface, to gather the SETTINGS configuration options the server wants to send to the client.
      Specified by:
      onPreface in interface Session.Listener
      Overrides:
      onPreface in class Session.Listener.Adapter
      Parameters:
      session - the session
      Returns:
      a (possibly empty or null) map containing SETTINGS configuration options to send.
    • onNewStream

      public Stream.Listener onNewStream(Stream stream, HeadersFrame frame)
      Description copied from interface: Session.Listener

      Callback method invoked when a new stream is being created upon receiving a HEADERS frame representing an HTTP request.

      Applications should implement this method to process HTTP requests, typically providing an HTTP response via Stream.headers(HeadersFrame, Callback).

      Applications can detect whether request DATA frames will be arriving by testing HeadersFrame.isEndStream(). If the application is interested in processing the DATA frames, it must return a Stream.Listener implementation that overrides Stream.Listener.onData(Stream, DataFrame, Callback).

      Specified by:
      onNewStream in interface Session.Listener
      Overrides:
      onNewStream in class Session.Listener.Adapter
      Parameters:
      stream - the newly created stream
      frame - the HEADERS frame received
      Returns:
      a Stream.Listener that will be notified of stream events
    • onBeforeData

      public void onBeforeData(Stream stream)
      Description copied from interface: Stream.Listener

      Callback method invoked before notifying the first DATA frame.

      The default implementation initializes the demand for DATA frames.

      Specified by:
      onBeforeData in interface Stream.Listener
      Parameters:
      stream - the stream
    • onIdleTimeout

      public boolean onIdleTimeout(Session session)
      Description copied from interface: Session.Listener

      Callback method invoked when the idle timeout expired.

      Specified by:
      onIdleTimeout in interface Session.Listener
      Overrides:
      onIdleTimeout in class Session.Listener.Adapter
      Parameters:
      session - the session
      Returns:
      whether the session should be closed
    • onClose

      public void onClose(Session session, GoAwayFrame frame, Callback callback)
      Description copied from interface: Session.Listener

      Callback method invoked when a GOAWAY frame caused the session to be closed.

      Specified by:
      onClose in interface Session.Listener
      Parameters:
      session - the session
      frame - the GOAWAY frame that caused the session to be closed
      callback - the callback to notify of the GOAWAY processing
    • onFailure

      public void onFailure(Session session, Throwable failure, Callback callback)
      Description copied from interface: Session.Listener

      Callback method invoked when a failure has been detected for this session.

      Specified by:
      onFailure in interface Session.Listener
      Parameters:
      session - the session
      failure - the failure
      callback - the callback to notify of failure processing
    • onHeaders

      public void onHeaders(Stream stream, HeadersFrame frame)
      Description copied from interface: Stream.Listener

      Callback method invoked when a HEADERS frame representing the HTTP response has been received.

      Specified by:
      onHeaders in interface Stream.Listener
      Parameters:
      stream - the stream
      frame - the HEADERS frame received
    • onPush

      public Stream.Listener onPush(Stream stream, PushPromiseFrame frame)
      Description copied from interface: Stream.Listener

      Callback method invoked when a PUSH_PROMISE frame has been received.

      Specified by:
      onPush in interface Stream.Listener
      Parameters:
      stream - the pushed stream
      frame - the PUSH_PROMISE frame received
      Returns:
      a Stream.Listener that will be notified of pushed stream events
    • onDataDemanded

      public void onDataDemanded(Stream stream, DataFrame frame, Callback callback)
      Description copied from interface: Stream.Listener

      Callback method invoked when a DATA frame has been demanded.

      Implementations of this method must arrange to call (within the method or otherwise asynchronously) Stream.demand(long).

      Specified by:
      onDataDemanded in interface Stream.Listener
      Parameters:
      stream - the stream
      frame - the DATA frame received
      callback - the callback to complete when the bytes of the DATA frame have been consumed
    • onReset

      public void onReset(Stream stream, ResetFrame frame, Callback callback)
      Description copied from interface: Stream.Listener

      Callback method invoked when a RST_STREAM frame has been received for this stream.

      Specified by:
      onReset in interface Stream.Listener
      Parameters:
      stream - the stream
      frame - the RST_FRAME received
      callback - the callback to complete when the reset has been handled
    • onFailure

      public void onFailure(Stream stream, int error, String reason, Throwable failure, Callback callback)
      Description copied from interface: Stream.Listener

      Callback method invoked when the stream failed.

      Specified by:
      onFailure in interface Stream.Listener
      Parameters:
      stream - the stream
      error - the error code
      reason - the error reason, or null
      failure - the failure
      callback - the callback to complete when the failure has been handled
    • onIdleTimeout

      public boolean onIdleTimeout(Stream stream, Throwable x)
      Description copied from interface: Stream.Listener

      Callback method invoked when the stream exceeds its idle timeout.

      Specified by:
      onIdleTimeout in interface Stream.Listener
      Parameters:
      stream - the stream
      x - the timeout failure
      Returns:
      true to reset the stream, false to ignore the idle timeout
      See Also: