-
@UnstableApi public interface Http2Stream
A single stream within an HTTP2 connection. Streams are compared to each other by priority.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Http2Stream.State
The allowed states of an HTTP2 stream.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Http2Stream
close()
Closes the stream.Http2Stream
closeLocalSide()
Closes the local side of this stream.Http2Stream
closeRemoteSide()
Closes the remote side of this stream.<V> V
getProperty(Http2Connection.PropertyKey key)
Returns application-defined data if any was associated with this stream.Http2Stream
headersReceived(boolean isInformational)
Indicates that headers have been received.Http2Stream
headersSent(boolean isInformational)
Indicates that headers have been sent to the remote endpoint on this stream.int
id()
Gets the unique identifier for this stream within the connection.boolean
isHeadersReceived()
Indicates whether or not the initial headers have been received.boolean
isHeadersSent()
Indicates whether or not headers were sent to the remote endpoint.boolean
isPushPromiseSent()
Indicates whether or not a push promise was sent to the remote endpoint.boolean
isResetSent()
Indicates whether aRST_STREAM
frame has been sent from the local endpoint for this stream.boolean
isTrailersReceived()
Indicates whether or not the trailers have been received.boolean
isTrailersSent()
Indicates whether or not trailers were sent to the remote endpoint.Http2Stream
open(boolean halfClosed)
Opens this stream, making it available viaHttp2Connection.forEachActiveStream(Http2StreamVisitor)
and transition state to:Http2Stream.State.OPEN
ifstate()
isHttp2Stream.State.IDLE
andhalfClosed
isfalse
.Http2Stream.State.HALF_CLOSED_LOCAL
ifstate()
isHttp2Stream.State.IDLE
andhalfClosed
istrue
and the stream is local.Http2Stream
pushPromiseSent()
Indicates that a push promise was sent to the remote endpoint.<V> V
removeProperty(Http2Connection.PropertyKey key)
Returns and removes application-defined data if any was associated with this stream.Http2Stream
resetSent()
Sets the flag indicating that aRST_STREAM
frame has been sent from the local endpoint for this stream.<V> V
setProperty(Http2Connection.PropertyKey key, V value)
Associates the application-defined data with this stream.Http2Stream.State
state()
Gets the state of this stream.
-
-
-
Method Detail
-
id
int id()
Gets the unique identifier for this stream within the connection.
-
state
Http2Stream.State state()
Gets the state of this stream.
-
open
Http2Stream open(boolean halfClosed) throws Http2Exception
Opens this stream, making it available viaHttp2Connection.forEachActiveStream(Http2StreamVisitor)
and transition state to:Http2Stream.State.OPEN
ifstate()
isHttp2Stream.State.IDLE
andhalfClosed
isfalse
.Http2Stream.State.HALF_CLOSED_LOCAL
ifstate()
isHttp2Stream.State.IDLE
andhalfClosed
istrue
and the stream is local. In this state,isHeadersSent()
istrue
Http2Stream.State.HALF_CLOSED_REMOTE
ifstate()
isHttp2Stream.State.IDLE
andhalfClosed
istrue
and the stream is remote. In this state,isHeadersReceived()
istrue
Http2Stream.State.RESERVED_LOCAL
ifstate()
isHttp2Stream.State.HALF_CLOSED_REMOTE
.Http2Stream.State.RESERVED_REMOTE
ifstate()
isHttp2Stream.State.HALF_CLOSED_LOCAL
.
- Throws:
Http2Exception
-
close
Http2Stream close()
Closes the stream.
-
closeLocalSide
Http2Stream closeLocalSide()
Closes the local side of this stream. If this makes the stream closed, the child is closed as well.
-
closeRemoteSide
Http2Stream closeRemoteSide()
Closes the remote side of this stream. If this makes the stream closed, the child is closed as well.
-
isResetSent
boolean isResetSent()
Indicates whether aRST_STREAM
frame has been sent from the local endpoint for this stream.
-
resetSent
Http2Stream resetSent()
Sets the flag indicating that aRST_STREAM
frame has been sent from the local endpoint for this stream. This does not affect the stream state.
-
setProperty
<V> V setProperty(Http2Connection.PropertyKey key, V value)
Associates the application-defined data with this stream.- Returns:
- The value that was previously associated with
key
, ornull
if there was none.
-
getProperty
<V> V getProperty(Http2Connection.PropertyKey key)
Returns application-defined data if any was associated with this stream.
-
removeProperty
<V> V removeProperty(Http2Connection.PropertyKey key)
Returns and removes application-defined data if any was associated with this stream.
-
headersSent
Http2Stream headersSent(boolean isInformational)
Indicates that headers have been sent to the remote endpoint on this stream. The first call to this method would be for the initial headers (seeisHeadersSent()
} and the second call would indicate the trailers (seeisTrailersReceived()
).- Parameters:
isInformational
-true
if the headers contain an informational status code (for responses only).
-
isHeadersSent
boolean isHeadersSent()
Indicates whether or not headers were sent to the remote endpoint.
-
isTrailersSent
boolean isTrailersSent()
Indicates whether or not trailers were sent to the remote endpoint.
-
headersReceived
Http2Stream headersReceived(boolean isInformational)
Indicates that headers have been received. The first call to this method would be for the initial headers (seeisHeadersReceived()
} and the second call would indicate the trailers (seeisTrailersReceived()
).- Parameters:
isInformational
-true
if the headers contain an informational status code (for responses only).
-
isHeadersReceived
boolean isHeadersReceived()
Indicates whether or not the initial headers have been received.
-
isTrailersReceived
boolean isTrailersReceived()
Indicates whether or not the trailers have been received.
-
pushPromiseSent
Http2Stream pushPromiseSent()
Indicates that a push promise was sent to the remote endpoint.
-
isPushPromiseSent
boolean isPushPromiseSent()
Indicates whether or not a push promise was sent to the remote endpoint.
-
-