Package io.netty.handler.codec.http2
Class DefaultHttp2Connection.DefaultStream
java.lang.Object
io.netty.handler.codec.http2.DefaultHttp2Connection.DefaultStream
- All Implemented Interfaces:
Http2Stream
- Direct Known Subclasses:
DefaultHttp2Connection.ConnectionStream
- Enclosing class:
DefaultHttp2Connection
Simple stream implementation. Streams can be compared to each other by priority.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classProvides the lazy initialization for theDefaultHttp2Connection.DefaultStreamdata map.Nested classes/interfaces inherited from interface io.netty.handler.codec.http2.Http2Stream
Http2Stream.State -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intprivate final longprivate static final byteprivate static final byteprivate static final byteprivate static final byteprivate static final byteprivate static final byteprivate byteprivate final DefaultHttp2Connection.DefaultStream.PropertyMapprivate Http2Stream.State -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidactivate()close()Closes the stream.(package private) Http2StreamCloses the local side of this stream.Closes the remote side of this stream.(package private) DefaultHttp2Connection.DefaultEndpoint<? extends Http2FlowController> booleanfinal <V> VReturns application-defined data if any was associated with this stream.inthashCode()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.final intid()Gets the unique identifier for this stream within the connection.booleanIndicates whether or not the initial headers have been received.booleanIndicates whether or not headers were sent to the remote endpoint.(package private) final booleanisLocal()booleanIndicates whether or not a push promise was sent to the remote endpoint.booleanIndicates whether aRST_STREAMframe has been sent from the local endpoint for this stream.booleanIndicates whether or not the trailers have been received.booleanIndicates 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.OPENifHttp2Stream.state()isHttp2Stream.State.IDLEandhalfClosedisfalse.Http2Stream.State.HALF_CLOSED_LOCALifHttp2Stream.state()isHttp2Stream.State.IDLEandhalfClosedistrueand the stream is local.Indicates that a push promise was sent to the remote endpoint.final <V> VReturns and removes application-defined data if any was associated with this stream.Sets the flag indicating that aRST_STREAMframe has been sent from the local endpoint for this stream.final <V> VsetProperty(Http2Connection.PropertyKey key, V value) Associates the application-defined data with this stream.final Http2Stream.Statestate()Gets the state of this stream.toString()
-
Field Details
-
META_STATE_SENT_RST
private static final byte META_STATE_SENT_RST- See Also:
-
META_STATE_SENT_HEADERS
private static final byte META_STATE_SENT_HEADERS- See Also:
-
META_STATE_SENT_TRAILERS
private static final byte META_STATE_SENT_TRAILERS- See Also:
-
META_STATE_SENT_PUSHPROMISE
private static final byte META_STATE_SENT_PUSHPROMISE- See Also:
-
META_STATE_RECV_HEADERS
private static final byte META_STATE_RECV_HEADERS- See Also:
-
META_STATE_RECV_TRAILERS
private static final byte META_STATE_RECV_TRAILERS- See Also:
-
id
private final int id -
identity
private final long identity -
properties
-
state
-
metaState
private byte metaState
-
-
Constructor Details
-
DefaultStream
DefaultStream(long identity, int id, Http2Stream.State state)
-
-
Method Details
-
id
public final int id()Description copied from interface:Http2StreamGets the unique identifier for this stream within the connection.- Specified by:
idin interfaceHttp2Stream
-
state
Description copied from interface:Http2StreamGets the state of this stream.- Specified by:
statein interfaceHttp2Stream
-
isResetSent
public boolean isResetSent()Description copied from interface:Http2StreamIndicates whether aRST_STREAMframe has been sent from the local endpoint for this stream.- Specified by:
isResetSentin interfaceHttp2Stream
-
resetSent
Description copied from interface:Http2StreamSets the flag indicating that aRST_STREAMframe has been sent from the local endpoint for this stream. This does not affect the stream state.- Specified by:
resetSentin interfaceHttp2Stream
-
headersSent
Description copied from interface:Http2StreamIndicates that headers have been sent to the remote endpoint on this stream. The first call to this method would be for the initial headers (seeHttp2Stream.isHeadersSent()} and the second call would indicate the trailers (seeHttp2Stream.isTrailersReceived()).- Specified by:
headersSentin interfaceHttp2Stream- Parameters:
isInformational-trueif the headers contain an informational status code (for responses only).
-
isHeadersSent
public boolean isHeadersSent()Description copied from interface:Http2StreamIndicates whether or not headers were sent to the remote endpoint.- Specified by:
isHeadersSentin interfaceHttp2Stream
-
isTrailersSent
public boolean isTrailersSent()Description copied from interface:Http2StreamIndicates whether or not trailers were sent to the remote endpoint.- Specified by:
isTrailersSentin interfaceHttp2Stream
-
headersReceived
Description copied from interface:Http2StreamIndicates that headers have been received. The first call to this method would be for the initial headers (seeHttp2Stream.isHeadersReceived()} and the second call would indicate the trailers (seeHttp2Stream.isTrailersReceived()).- Specified by:
headersReceivedin interfaceHttp2Stream- Parameters:
isInformational-trueif the headers contain an informational status code (for responses only).
-
isHeadersReceived
public boolean isHeadersReceived()Description copied from interface:Http2StreamIndicates whether or not the initial headers have been received.- Specified by:
isHeadersReceivedin interfaceHttp2Stream
-
isTrailersReceived
public boolean isTrailersReceived()Description copied from interface:Http2StreamIndicates whether or not the trailers have been received.- Specified by:
isTrailersReceivedin interfaceHttp2Stream
-
pushPromiseSent
Description copied from interface:Http2StreamIndicates that a push promise was sent to the remote endpoint.- Specified by:
pushPromiseSentin interfaceHttp2Stream
-
isPushPromiseSent
public boolean isPushPromiseSent()Description copied from interface:Http2StreamIndicates whether or not a push promise was sent to the remote endpoint.- Specified by:
isPushPromiseSentin interfaceHttp2Stream
-
setProperty
Description copied from interface:Http2StreamAssociates the application-defined data with this stream.- Specified by:
setPropertyin interfaceHttp2Stream- Returns:
- The value that was previously associated with
key, ornullif there was none.
-
getProperty
Description copied from interface:Http2StreamReturns application-defined data if any was associated with this stream.- Specified by:
getPropertyin interfaceHttp2Stream
-
removeProperty
Description copied from interface:Http2StreamReturns and removes application-defined data if any was associated with this stream.- Specified by:
removePropertyin interfaceHttp2Stream
-
open
Description copied from interface:Http2StreamOpens this stream, making it available viaHttp2Connection.forEachActiveStream(Http2StreamVisitor)and transition state to:Http2Stream.State.OPENifHttp2Stream.state()isHttp2Stream.State.IDLEandhalfClosedisfalse.Http2Stream.State.HALF_CLOSED_LOCALifHttp2Stream.state()isHttp2Stream.State.IDLEandhalfClosedistrueand the stream is local. In this state,Http2Stream.isHeadersSent()istrueHttp2Stream.State.HALF_CLOSED_REMOTEifHttp2Stream.state()isHttp2Stream.State.IDLEandhalfClosedistrueand the stream is remote. In this state,Http2Stream.isHeadersReceived()istrueHttp2Stream.State.RESERVED_LOCALifHttp2Stream.state()isHttp2Stream.State.HALF_CLOSED_REMOTE.Http2Stream.State.RESERVED_REMOTEifHttp2Stream.state()isHttp2Stream.State.HALF_CLOSED_LOCAL.
- Specified by:
openin interfaceHttp2Stream- Throws:
Http2Exception
-
activate
void activate() -
close
-
close
Description copied from interface:Http2StreamCloses the stream.- Specified by:
closein interfaceHttp2Stream
-
closeLocalSide
Description copied from interface:Http2StreamCloses the local side of this stream. If this makes the stream closed, the child is closed as well.- Specified by:
closeLocalSidein interfaceHttp2Stream
-
closeRemoteSide
Description copied from interface:Http2StreamCloses the remote side of this stream. If this makes the stream closed, the child is closed as well.- Specified by:
closeRemoteSidein interfaceHttp2Stream
-
createdBy
DefaultHttp2Connection.DefaultEndpoint<? extends Http2FlowController> createdBy() -
isLocal
final boolean isLocal() -
equals
-
hashCode
public int hashCode() -
toString
-