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
private class DefaultHttp2Connection.DefaultStream extends java.lang.Object implements Http2Stream
Simple stream implementation. Streams can be compared to each other by priority.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
DefaultHttp2Connection.DefaultStream.PropertyMap
Provides the lazy initialization for theDefaultHttp2Connection.DefaultStream
data map.-
Nested classes/interfaces inherited from interface io.netty.handler.codec.http2.Http2Stream
Http2Stream.State
-
-
Field Summary
Fields Modifier and Type Field Description private int
id
private long
identity
private static byte
META_STATE_RECV_HEADERS
private static byte
META_STATE_RECV_TRAILERS
private static byte
META_STATE_SENT_HEADERS
private static byte
META_STATE_SENT_PUSHPROMISE
private static byte
META_STATE_SENT_RST
private static byte
META_STATE_SENT_TRAILERS
private byte
metaState
private DefaultHttp2Connection.DefaultStream.PropertyMap
properties
private Http2Stream.State
state
-
Constructor Summary
Constructors Constructor Description DefaultStream(long identity, int id, Http2Stream.State state)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
activate()
Http2Stream
close()
Closes the stream.(package private) Http2Stream
close(java.util.Iterator<?> itr)
Http2Stream
closeLocalSide()
Closes the local side of this stream.Http2Stream
closeRemoteSide()
Closes the remote side of this stream.(package private) DefaultHttp2Connection.DefaultEndpoint<? extends Http2FlowController>
createdBy()
boolean
equals(java.lang.Object obj)
<V> V
getProperty(Http2Connection.PropertyKey key)
Returns application-defined data if any was associated with this stream.int
hashCode()
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.(package private) boolean
isLocal()
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
ifHttp2Stream.state()
isHttp2Stream.State.IDLE
andhalfClosed
isfalse
.Http2Stream.State.HALF_CLOSED_LOCAL
ifHttp2Stream.state()
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.
-
-
-
Field Detail
-
META_STATE_SENT_RST
private static final byte META_STATE_SENT_RST
- See Also:
- Constant Field Values
-
META_STATE_SENT_HEADERS
private static final byte META_STATE_SENT_HEADERS
- See Also:
- Constant Field Values
-
META_STATE_SENT_TRAILERS
private static final byte META_STATE_SENT_TRAILERS
- See Also:
- Constant Field Values
-
META_STATE_SENT_PUSHPROMISE
private static final byte META_STATE_SENT_PUSHPROMISE
- See Also:
- Constant Field Values
-
META_STATE_RECV_HEADERS
private static final byte META_STATE_RECV_HEADERS
- See Also:
- Constant Field Values
-
META_STATE_RECV_TRAILERS
private static final byte META_STATE_RECV_TRAILERS
- See Also:
- Constant Field Values
-
id
private final int id
-
identity
private final long identity
-
properties
private final DefaultHttp2Connection.DefaultStream.PropertyMap properties
-
state
private Http2Stream.State state
-
metaState
private byte metaState
-
-
Constructor Detail
-
DefaultStream
DefaultStream(long identity, int id, Http2Stream.State state)
-
-
Method Detail
-
id
public final int id()
Description copied from interface:Http2Stream
Gets the unique identifier for this stream within the connection.- Specified by:
id
in interfaceHttp2Stream
-
state
public final Http2Stream.State state()
Description copied from interface:Http2Stream
Gets the state of this stream.- Specified by:
state
in interfaceHttp2Stream
-
isResetSent
public boolean isResetSent()
Description copied from interface:Http2Stream
Indicates whether aRST_STREAM
frame has been sent from the local endpoint for this stream.- Specified by:
isResetSent
in interfaceHttp2Stream
-
resetSent
public Http2Stream resetSent()
Description copied from interface:Http2Stream
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.- Specified by:
resetSent
in interfaceHttp2Stream
-
headersSent
public Http2Stream headersSent(boolean isInformational)
Description copied from interface:Http2Stream
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 (seeHttp2Stream.isHeadersSent()
} and the second call would indicate the trailers (seeHttp2Stream.isTrailersReceived()
).- Specified by:
headersSent
in interfaceHttp2Stream
- Parameters:
isInformational
-true
if the headers contain an informational status code (for responses only).
-
isHeadersSent
public boolean isHeadersSent()
Description copied from interface:Http2Stream
Indicates whether or not headers were sent to the remote endpoint.- Specified by:
isHeadersSent
in interfaceHttp2Stream
-
isTrailersSent
public boolean isTrailersSent()
Description copied from interface:Http2Stream
Indicates whether or not trailers were sent to the remote endpoint.- Specified by:
isTrailersSent
in interfaceHttp2Stream
-
headersReceived
public Http2Stream headersReceived(boolean isInformational)
Description copied from interface:Http2Stream
Indicates 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:
headersReceived
in interfaceHttp2Stream
- Parameters:
isInformational
-true
if the headers contain an informational status code (for responses only).
-
isHeadersReceived
public boolean isHeadersReceived()
Description copied from interface:Http2Stream
Indicates whether or not the initial headers have been received.- Specified by:
isHeadersReceived
in interfaceHttp2Stream
-
isTrailersReceived
public boolean isTrailersReceived()
Description copied from interface:Http2Stream
Indicates whether or not the trailers have been received.- Specified by:
isTrailersReceived
in interfaceHttp2Stream
-
pushPromiseSent
public Http2Stream pushPromiseSent()
Description copied from interface:Http2Stream
Indicates that a push promise was sent to the remote endpoint.- Specified by:
pushPromiseSent
in interfaceHttp2Stream
-
isPushPromiseSent
public boolean isPushPromiseSent()
Description copied from interface:Http2Stream
Indicates whether or not a push promise was sent to the remote endpoint.- Specified by:
isPushPromiseSent
in interfaceHttp2Stream
-
setProperty
public final <V> V setProperty(Http2Connection.PropertyKey key, V value)
Description copied from interface:Http2Stream
Associates the application-defined data with this stream.- Specified by:
setProperty
in interfaceHttp2Stream
- Returns:
- The value that was previously associated with
key
, ornull
if there was none.
-
getProperty
public final <V> V getProperty(Http2Connection.PropertyKey key)
Description copied from interface:Http2Stream
Returns application-defined data if any was associated with this stream.- Specified by:
getProperty
in interfaceHttp2Stream
-
removeProperty
public final <V> V removeProperty(Http2Connection.PropertyKey key)
Description copied from interface:Http2Stream
Returns and removes application-defined data if any was associated with this stream.- Specified by:
removeProperty
in interfaceHttp2Stream
-
open
public Http2Stream open(boolean halfClosed) throws Http2Exception
Description copied from interface:Http2Stream
Opens this stream, making it available viaHttp2Connection.forEachActiveStream(Http2StreamVisitor)
and transition state to:Http2Stream.State.OPEN
ifHttp2Stream.state()
isHttp2Stream.State.IDLE
andhalfClosed
isfalse
.Http2Stream.State.HALF_CLOSED_LOCAL
ifHttp2Stream.state()
isHttp2Stream.State.IDLE
andhalfClosed
istrue
and the stream is local. In this state,Http2Stream.isHeadersSent()
istrue
Http2Stream.State.HALF_CLOSED_REMOTE
ifHttp2Stream.state()
isHttp2Stream.State.IDLE
andhalfClosed
istrue
and the stream is remote. In this state,Http2Stream.isHeadersReceived()
istrue
Http2Stream.State.RESERVED_LOCAL
ifHttp2Stream.state()
isHttp2Stream.State.HALF_CLOSED_REMOTE
.Http2Stream.State.RESERVED_REMOTE
ifHttp2Stream.state()
isHttp2Stream.State.HALF_CLOSED_LOCAL
.
- Specified by:
open
in interfaceHttp2Stream
- Throws:
Http2Exception
-
activate
void activate()
-
close
Http2Stream close(java.util.Iterator<?> itr)
-
close
public Http2Stream close()
Description copied from interface:Http2Stream
Closes the stream.- Specified by:
close
in interfaceHttp2Stream
-
closeLocalSide
public Http2Stream closeLocalSide()
Description copied from interface:Http2Stream
Closes the local side of this stream. If this makes the stream closed, the child is closed as well.- Specified by:
closeLocalSide
in interfaceHttp2Stream
-
closeRemoteSide
public Http2Stream closeRemoteSide()
Description copied from interface:Http2Stream
Closes the remote side of this stream. If this makes the stream closed, the child is closed as well.- Specified by:
closeRemoteSide
in interfaceHttp2Stream
-
createdBy
DefaultHttp2Connection.DefaultEndpoint<? extends Http2FlowController> createdBy()
-
isLocal
final boolean isLocal()
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-