Interface ISession
-
- All Superinterfaces:
Session
- All Known Implementing Classes:
HTTP2ClientSession,HTTP2ServerSession,HTTP2Session
public interface ISession extends Session
The SPI interface for implementing an HTTP/2 session.
This class extends
Sessionby adding the methods required to implement the HTTP/2 session functionalities.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.http2.api.Session
Session.Listener
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddata(IStream stream, Callback callback, DataFrame frame)Enqueues the given DATA frame to be written to the connection.voidframes(IStream stream, java.util.List<? extends Frame> frames, Callback callback)Enqueues the given frames to be written to the connection.longgetBytesWritten()IStreamgetStream(int streamId)Retrieves the stream with the givenstreamId.booleanisPushEnabled()voidnewStream(IStream.FrameList frames, Promise<Stream> promise, Stream.Listener listener)Sends the given list of frames to create a newStream.voidonData(DataFrame frame, Callback callback)Callback method invoked when a DATA frame is received.voidonFlushed(long bytes)Callback method invoked when bytes are flushed to the network.voidonFrame(Frame frame)Callback method invoked during an HTTP/1.1 to HTTP/2 upgrade requests to process the given synthetic frame.booleanonIdleTimeout()Callback invoked when the idle timeout expires.voidonShutdown()Callback invoked when the connection reads -1.voidonWindowUpdate(IStream stream, WindowUpdateFrame frame)Callback method invoked when a WINDOW_UPDATE frame has been received.voidpush(IStream stream, Promise<Stream> promise, PushPromiseFrame frame, Stream.Listener listener)Enqueues the given PUSH_PROMISE frame to be written to the connection.booleanremoveStream(IStream stream)Removes the givenstream.intupdateRecvWindow(int delta)Updates the session receive window by the givendelta.intupdateSendWindow(int delta)Updates the session send window by the givendelta.
-
-
-
Method Detail
-
getStream
IStream getStream(int streamId)
Description copied from interface:SessionRetrieves the stream with the given
streamId.
-
removeStream
boolean removeStream(IStream stream)
Removes the given
stream.- Parameters:
stream- the stream to remove- Returns:
- whether the stream was removed
-
newStream
void newStream(IStream.FrameList frames, Promise<Stream> promise, Stream.Listener listener)
Sends the given list of frames to create a new
Stream.- Parameters:
frames- the list of frames to sendpromise- the promise that gets notified of the stream creationlistener- the listener that gets notified of stream events
-
frames
void frames(IStream stream, java.util.List<? extends Frame> frames, Callback callback)
Enqueues the given frames to be written to the connection.
- Parameters:
stream- the stream the frames belong toframes- the frames to enqueuecallback- the callback that gets notified when the frames have been sent
-
push
void push(IStream stream, Promise<Stream> promise, PushPromiseFrame frame, Stream.Listener listener)
Enqueues the given PUSH_PROMISE frame to be written to the connection.
Differently from
frames(IStream, List, Callback), this method generates atomically the stream id for the pushed stream.- Parameters:
stream- the stream associated to the pushed streampromise- the promise that gets notified of the pushed stream creationframe- the PUSH_PROMISE frame to enqueuelistener- the listener that gets notified of pushed stream events
-
data
void data(IStream stream, Callback callback, DataFrame frame)
Enqueues the given DATA frame to be written to the connection.
- Parameters:
stream- the stream the data frame belongs tocallback- the callback that gets notified when the frame has been sentframe- the DATA frame to send
-
updateSendWindow
int updateSendWindow(int delta)
Updates the session send window by the given
delta.- Parameters:
delta- the delta value (positive or negative) to add to the session send window- Returns:
- the previous value of the session send window
-
updateRecvWindow
int updateRecvWindow(int delta)
Updates the session receive window by the given
delta.- Parameters:
delta- the delta value (positive or negative) to add to the session receive window- Returns:
- the previous value of the session receive window
-
onWindowUpdate
void onWindowUpdate(IStream stream, WindowUpdateFrame frame)
Callback method invoked when a WINDOW_UPDATE frame has been received.
- Parameters:
stream- the stream the window update belongs to, or null if the window update belongs to the sessionframe- the WINDOW_UPDATE frame received
-
isPushEnabled
boolean isPushEnabled()
- Returns:
- whether the push functionality is enabled
-
onShutdown
void onShutdown()
Callback invoked when the connection reads -1.
-
onIdleTimeout
boolean onIdleTimeout()
Callback invoked when the idle timeout expires.
- Returns:
trueif the session has expired- See Also:
onShutdown(),Session.close(int, String, Callback)
-
onFrame
void onFrame(Frame frame)
Callback method invoked during an HTTP/1.1 to HTTP/2 upgrade requests to process the given synthetic frame.
- Parameters:
frame- the synthetic frame to process
-
onFlushed
void onFlushed(long bytes) throws java.io.IOExceptionCallback method invoked when bytes are flushed to the network.
- Parameters:
bytes- the number of bytes flushed to the network- Throws:
java.io.IOException- if the flush should fail
-
getBytesWritten
long getBytesWritten()
- Returns:
- the number of bytes written by this session
-
-