public static class SessionFrameListener.Adapter extends Object implements SessionFrameListener
Empty implementation of SessionFrameListener
SessionFrameListener.Adapter
Constructor and Description |
---|
SessionFrameListener.Adapter() |
Modifier and Type | Method and Description |
---|---|
void |
onException(Throwable x)
Callback invoked when an exception is thrown during the processing of an event on a
SPDY session.
|
void |
onGoAway(Session session,
GoAwayInfo goAwayInfo)
Callback invoked when the other peer signals that it is closing the connection.
|
void |
onPing(Session session,
PingInfo pingInfo)
Callback invoked when a ping request has completed its round-trip.
|
void |
onRst(Session session,
RstInfo rstInfo)
Callback invoked when a stream error happens.
|
void |
onSettings(Session session,
SettingsInfo settingsInfo)
Callback invoked when a request to configure the SPDY connection has been received.
|
StreamFrameListener |
onSyn(Stream stream,
SynInfo synInfo)
Callback invoked when a request to create a stream has been received.
|
public StreamFrameListener onSyn(Stream stream, SynInfo synInfo)
SessionFrameListener
Callback invoked when a request to create a stream has been received.
Application code should implement this method and reply to the stream creation, eventually sending data:
public Stream.FrameListener onSyn(Stream stream, SynInfo synInfo) { // Do something with the metadata contained in synInfo if (stream.isHalfClosed()) // The other peer will not send data { stream.reply(new ReplyInfo(false)); stream.data(new StringDataInfo("foo", true)); return null; // Not interested in further stream events } ... }
Alternatively, if the stream creation requires reading data sent from the other peer:
public Stream.FrameListener onSyn(Stream stream, SynInfo synInfo) { // Do something with the metadata contained in synInfo if (!stream.isHalfClosed()) // The other peer will send data { stream.reply(new ReplyInfo(true)); return new Stream.FrameListener.Adapter() // Interested in stream events { public void onData(Stream stream, DataInfo dataInfo) { // Do something with the incoming data in dataInfo } }; } ... }
onSyn
in interface SessionFrameListener
stream
- the stream just createdsynInfo
- the metadata sent on stream creationpublic void onRst(Session session, RstInfo rstInfo)
SessionFrameListener
Callback invoked when a stream error happens.
onRst
in interface SessionFrameListener
session
- the sessionrstInfo
- the metadata of the stream errorpublic void onSettings(Session session, SettingsInfo settingsInfo)
SessionFrameListener
Callback invoked when a request to configure the SPDY connection has been received.
onSettings
in interface SessionFrameListener
session
- the sessionsettingsInfo
- the metadata sent to configurepublic void onPing(Session session, PingInfo pingInfo)
SessionFrameListener
Callback invoked when a ping request has completed its round-trip.
onPing
in interface SessionFrameListener
session
- the sessionpingInfo
- the metadata receivedpublic void onGoAway(Session session, GoAwayInfo goAwayInfo)
SessionFrameListener
Callback invoked when the other peer signals that it is closing the connection.
onGoAway
in interface SessionFrameListener
session
- the sessiongoAwayInfo
- the metadata sentpublic void onException(Throwable x)
SessionFrameListener
Callback invoked when an exception is thrown during the processing of an event on a SPDY session.
Examples of such conditions are invalid frames received, corrupted headers compression state, etc.
onException
in interface SessionFrameListener
x
- the exception that caused the event processing failureCopyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.