Package io.netty.handler.codec.http2
Interface Http2Stream
- All Known Implementing Classes:
DefaultHttp2Connection.ConnectionStream
,DefaultHttp2Connection.DefaultStream
A single stream within an HTTP2 connection. Streams are compared to each other by priority.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enum
The allowed states of an HTTP2 stream. -
Method Summary
Modifier and TypeMethodDescriptionclose()
Closes the stream.Closes the local side of this stream.Closes the remote side of this stream.<V> V
Returns application-defined data if any was associated with this stream.headersReceived
(boolean isInformational) Indicates that headers have been received.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
Indicates whether or not the initial headers have been received.boolean
Indicates whether or not headers were sent to the remote endpoint.boolean
Indicates whether or not a push promise was sent to the remote endpoint.boolean
Indicates whether aRST_STREAM
frame has been sent from the local endpoint for this stream.boolean
Indicates whether or not the trailers have been received.boolean
Indicates whether or not trailers were sent to the remote endpoint.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.Indicates that a push promise was sent to the remote endpoint.<V> V
Returns and removes application-defined data if any was associated with this stream.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.state()
Gets the state of this stream.
-
Method Details
-
id
int id()Gets the unique identifier for this stream within the connection. -
state
Http2Stream.State state()Gets the state of this stream. -
open
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
Associates the application-defined data with this stream.- Returns:
- The value that was previously associated with
key
, ornull
if there was none.
-
getProperty
Returns application-defined data if any was associated with this stream. -
removeProperty
Returns and removes application-defined data if any was associated with this stream. -
headersSent
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
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.
-