public class Http2Stream extends Object implements AttributeStorage, OutputSink, Closeable
| Modifier and Type | Class and Description |
|---|---|
protected static class |
Http2Stream.Termination |
protected static class |
Http2Stream.TerminationType |
| Modifier and Type | Field and Description |
|---|---|
static String |
HTTP2_STREAM_ATTRIBUTE |
| Modifier | Constructor and Description |
|---|---|
protected |
Http2Stream(Http2Connection http2Connection,
HttpRequestPacket request,
int priority,
Http2StreamState initState)
Construct upgrade stream, which is half HTTP, half HTTP2
|
protected |
Http2Stream(Http2Connection http2Connection,
HttpRequestPacket request,
int streamId,
int refStreamId,
int priority,
Http2StreamState initState)
Create HTTP2 stream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCloseListener(CloseListener closeListener)
Add the
CloseListener, which will be notified once the stream
will be closed. |
PushResource |
addPushResource(String url,
PushResource pushResource) |
void |
assertOpen()
Checks if this Closeable is open and ready to be used.
|
boolean |
canWrite() |
boolean |
canWrite(int length)
Deprecated.
|
GrizzlyFuture<Closeable> |
close()
Gracefully (if supported by the implementation) closes this stream and
releases any system resources associated with it.
|
void |
close(CompletionHandler<Closeable> completionHandler)
Deprecated.
please use
close() with the following GrizzlyFuture.addCompletionHandler(org.glassfish.grizzly.CompletionHandler) call |
GrizzlyFuture<CloseReason> |
closeFuture() |
void |
closeSilently()
Gracefully (if supported by the implementation) closes this stream and
releases any system resources associated with it.
|
void |
closeWithReason(IOException cause)
Gracefully closes the Closeable and provides the reason description.
|
AttributeHolder |
getAttributes()
Get associated
AttributeHolder. |
int |
getId() |
int |
getLocalWindowSize() |
int |
getPeerWindowSize() |
int |
getPriority() |
int |
getReferStreamId() |
HttpRequestPacket |
getRequest() |
HttpResponsePacket |
getResponse() |
Http2StreamState |
getState() |
static Http2Stream |
getStreamFor(HttpHeader httpHeader) |
int |
getUnflushedWritesCount() |
boolean |
isLocallyInitiatedStream() |
boolean |
isOpen()
Is Closeable open and ready.
|
boolean |
isPushStream() |
void |
notifyCanWrite(WriteHandler writeHandler)
Instructs the
OutputSink to invoke the provided
WriteHandler when it is possible to write more bytes (or characters). |
void |
notifyCanWrite(WriteHandler handler,
int length)
Deprecated.
|
boolean |
removeCloseListener(CloseListener closeListener)
Remove the
CloseListener. |
PushResource |
removePushResource(String url) |
GrizzlyFuture<Closeable> |
terminate()
Closes this stream and releases any system resources associated with it.
|
void |
terminateSilently()
Closes this stream and releases any system resources associated with it.
|
void |
terminateWithReason(IOException cause)
Closes the Closeable and provides the reason description.
|
public static final String HTTP2_STREAM_ATTRIBUTE
protected Http2Stream(Http2Connection http2Connection, HttpRequestPacket request, int streamId, int refStreamId, int priority, Http2StreamState initState)
http2Connection - request - streamId - refStreamId - priority - initState - protected Http2Stream(Http2Connection http2Connection, HttpRequestPacket request, int priority, Http2StreamState initState)
http2Connection - request - priority - initState - public static Http2Stream getStreamFor(HttpHeader httpHeader)
public Http2StreamState getState()
public int getPeerWindowSize()
public int getLocalWindowSize()
public int getUnflushedWritesCount()
public HttpRequestPacket getRequest()
public HttpResponsePacket getResponse()
public PushResource addPushResource(String url, PushResource pushResource)
public PushResource removePushResource(String url)
public int getId()
public int getReferStreamId()
public int getPriority()
public boolean isPushStream()
public boolean isLocallyInitiatedStream()
public boolean isOpen()
Closeablepublic void assertOpen()
throws IOException
CloseableIOException giving the reason why this Closeable
was closed.assertOpen in interface CloseableIOExceptionpublic AttributeHolder getAttributes()
AttributeStorageAttributeHolder.
Implementation may return null if AttributeHolder wasn't
initialized yet.getAttributes in interface AttributeStorageAttributeHolder.
Implementation may return null if AttributeHolder wasn't
initialized yet.@Deprecated public boolean canWrite(int length)
canWrite in interface OutputSinklength - specifies the number of bytes (or characters) that require writingtrue if a write to this OutputSink
will succeed, otherwise returns false.public boolean canWrite()
canWrite in interface OutputSinktrue if a write to this OutputSink
will succeed, otherwise returns false.@Deprecated public void notifyCanWrite(WriteHandler handler, int length)
OutputSinkOutputSink to invoke the provided
WriteHandler when it is possible to write length
bytes (or characters).
Note that once the WriteHandler has been notified, it will not
be considered for notification again at a later point in time.notifyCanWrite in interface OutputSinkhandler - the WriteHandler that should be notified
when it's possible to write length bytes.length - the number of bytes or characters that require writing.public void notifyCanWrite(WriteHandler writeHandler)
OutputSinkOutputSink to invoke the provided
WriteHandler when it is possible to write more bytes (or characters).
Note that once the WriteHandler has been notified, it will not
be considered for notification again at a later point in time.notifyCanWrite in interface OutputSinkwriteHandler - the WriteHandler that should be notified
when it's possible to write more data.public GrizzlyFuture<Closeable> terminate()
Closeablepublic void terminateSilently()
CloseableterminateSilently in interface Closeablepublic void terminateWithReason(IOException cause)
CloseableCloseable.terminateSilently(), but additionally
provides the reason why the Closeable will be closed.terminateWithReason in interface Closeablepublic GrizzlyFuture<Closeable> close()
Closeablepublic void closeSilently()
CloseablecloseSilently in interface Closeablepublic void close(CompletionHandler<Closeable> completionHandler)
close() with the following GrizzlyFuture.addCompletionHandler(org.glassfish.grizzly.CompletionHandler) callclose in interface CloseablecompletionHandler - CompletionHandler to be called, when
the stream is closedpublic void closeWithReason(IOException cause)
CloseableCloseable.closeSilently(), but additionally
provides the reason why the Closeable will be closed.closeWithReason in interface Closeablepublic void addCloseListener(CloseListener closeListener)
CloseableCloseListener, which will be notified once the stream
will be closed.addCloseListener in interface CloseablecloseListener - CloseListener.public boolean removeCloseListener(CloseListener closeListener)
CloseableCloseListener.removeCloseListener in interface CloseablecloseListener - CloseListener.public GrizzlyFuture<CloseReason> closeFuture()
closeFuture in interface CloseableFuture, that will be notified once this Closeable
is closedCopyright © 2021 Oracle Corporation. All rights reserved.