Interface Session.Listener
- All Known Subinterfaces:
ServerSessionListener
- All Known Implementing Classes:
HTTP2ServerConnectionFactory.HTTPServerSessionListener
,HTTPSessionListenerPromise
- Enclosing interface:
- Session
A Session.Listener
is the passive counterpart of a Session
and
receives events happening on an HTTP/2 connection.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
onClose
(Session session, GoAwayFrame frame, Callback callback) Callback method invoked when a GOAWAY frame caused the session to be closed.default void
Callback method invoked when a failure has been detected for this session.default void
onGoAway
(Session session, GoAwayFrame frame) Callback method invoked when a GOAWAY frame has been received.default boolean
onIdleTimeout
(Session session) Callback method invoked when the idle timeout expired.default Stream.Listener
onNewStream
(Stream stream, HeadersFrame frame) Callback method invoked when a new stream is being created upon receiving a HEADERS frame representing an HTTP request.default void
Callback method invoked when a PING frame has been received.Callback method invoked:default void
onReset
(Session session, ResetFrame frame) Callback method invoked when a RST_STREAM frame has been received for an unknown stream.default void
onSettings
(Session session, SettingsFrame frame) Callback method invoked when a SETTINGS frame has been received.
-
Method Details
-
onPreface
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.
- Parameters:
session
- the session- Returns:
- a (possibly empty or null) map containing SETTINGS configuration options to send.
-
onNewStream
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 demand for DATA frames usingStream.demand()
and then return either aStream.Listener
implementation that overridesStream.Listener.onDataAvailable(Stream)
where applications can read from theStream
viaStream.readData()
, orStream.Listener.AUTO_DISCARD
that automatically reads and discards DATA frames. Returningnull
is possible but discouraged, and has the same effect of demanding and discarding the DATA frames.- Parameters:
stream
- the newly created streamframe
- the HEADERS frame received- Returns:
- a
Stream.Listener
that will be notified of stream events
-
onSettings
Callback method invoked when a SETTINGS frame has been received.
- Parameters:
session
- the sessionframe
- the SETTINGS frame received
-
onPing
Callback method invoked when a PING frame has been received.
- Parameters:
session
- the sessionframe
- the PING frame received
-
onReset
Callback method invoked when a RST_STREAM frame has been received for an unknown stream.
- Parameters:
session
- the sessionframe
- the RST_STREAM frame received- See Also:
-
onGoAway
Callback method invoked when a GOAWAY frame has been received.
- Parameters:
session
- the sessionframe
- the GOAWAY frame received
-
onClose
Callback method invoked when a GOAWAY frame caused the session to be closed.
- Parameters:
session
- the sessionframe
- the GOAWAY frame that caused the session to be closedcallback
- the callback to notify of the GOAWAY processing
-
onIdleTimeout
Callback method invoked when the idle timeout expired.
- Parameters:
session
- the session- Returns:
- whether the session should be closed
-
onFailure
Callback method invoked when a failure has been detected for this session.
- Parameters:
session
- the sessionfailure
- the failurecallback
- the callback to notify of failure processing
-