Class HTTP2Stream
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Stream
,IStream
,CyclicTimeouts.Expirable
,Attachable
,Callback
,Dumpable
,Invocable
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.Callback
Callback.Completable, Callback.Completing, Callback.Nested
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.component.Dumpable
Dumpable.DumpableContainer
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable
Invocable.InvocationType, Invocable.ReadyTask, Invocable.Task
Nested classes/interfaces inherited from interface org.eclipse.jetty.http2.IStream
IStream.FrameList
Nested classes/interfaces inherited from interface org.eclipse.jetty.http2.api.Stream
Stream.Listener
-
Field Summary
Fields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking
-
Constructor Summary
ConstructorDescriptionHTTP2Stream
(ISession session, int streamId, MetaData.Request request, boolean local) HTTP2Stream
(Scheduler scheduler, ISession session, int streamId, MetaData.Request request, boolean local) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Forcibly closes this stream.void
commit()
Marks this stream as committed.void
Sends the given DATAframe
.int
dataSize()
void
demand
(long n) Demandsn
moreDATA
frames for this stream.dump()
void
dump
(Appendable out, String indent) Dump this object (and children) into an Appendable using the provided indent after any new lines.boolean
Fail all data queued in the stream and reset demand to 0.void
Callback invoked when the operation fails.getAttribute
(String key) long
Returns the expiration time in nanoseconds.int
getId()
long
int
int
void
headers
(HeadersFrame frame, Callback callback) Sends the given HEADERSframe
.boolean
isClosed()
boolean
boolean
isLocal()
boolean
boolean
isOpen()
boolean
boolean
isReset()
boolean
void
notIdle()
Marks this stream as not idle so that theidle timeout
is postponed.void
onClose()
protected void
onIdleExpired
(TimeoutException timeout) void
Processes the givenframe
, belonging to this stream.void
push
(PushPromiseFrame frame, Promise<Stream> promise, Stream.Listener listener) Sends the given PUSH_PROMISEframe
.removeAttribute
(String key) void
reset
(ResetFrame frame, Callback callback) Sends the given RST_STREAMframe
.void
send
(IStream.FrameList frameList, Callback callback) Sends the given list of frames.void
setAttachment
(Object attachment) Attaches the given object to this stream for later retrieval.void
setAttribute
(String key, Object value) void
setIdleTimeout
(long idleTimeout) void
setListener
(Stream.Listener listener) void
Callback invoked when the operation completes.toString()
boolean
updateClose
(boolean update, CloseState.Event event) Updates the close state of this stream.int
updateRecvWindow
(int delta) Updates the stream receive window by the givendelta
.int
updateSendWindow
(int delta) Updates the stream send window by the givendelta
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.util.Callback
completeWith
-
Constructor Details
-
HTTP2Stream
-
HTTP2Stream
@Deprecated public HTTP2Stream(Scheduler scheduler, ISession session, int streamId, MetaData.Request request, boolean local) Deprecated.
-
-
Method Details
-
getId
public int getId() -
getAttachment
- Specified by:
getAttachment
in interfaceAttachable
- Returns:
- the object attached to this instance
- See Also:
-
setAttachment
Description copied from interface:Attachable
Attaches the given object to this stream for later retrieval.- Specified by:
setAttachment
in interfaceAttachable
- Parameters:
attachment
- the object to attach to this instance
-
isLocal
public boolean isLocal() -
getSession
- Specified by:
getSession
in interfaceIStream
- Specified by:
getSession
in interfaceStream
- Returns:
- the session this stream is associated to
-
headers
Description copied from interface:Stream
Sends the given HEADERS
frame
.Typically used to send an HTTP response or to send the HTTP response trailers.
-
send
Description copied from interface:IStream
Sends the given list of frames.
Typically used to send HTTP headers along with content and possibly trailers.
-
push
Description copied from interface:Stream
Sends the given PUSH_PROMISE
frame
. -
data
Description copied from interface:Stream
Sends the given DATA
frame
. -
reset
Description copied from interface:Stream
Sends the given RST_STREAM
frame
. -
getAttribute
- Specified by:
getAttribute
in interfaceStream
- Parameters:
key
- the attribute key- Returns:
- an arbitrary object associated with the given key to this stream or null if no object can be found for the given key.
- See Also:
-
setAttribute
- Specified by:
setAttribute
in interfaceStream
- Parameters:
key
- the attribute keyvalue
- an arbitrary object to associate with the given key to this stream- See Also:
-
removeAttribute
- Specified by:
removeAttribute
in interfaceStream
- Parameters:
key
- the attribute key- Returns:
- the arbitrary object associated with the given key to this stream
- See Also:
-
isReset
public boolean isReset() -
isResetOrFailed
public boolean isResetOrFailed()- Specified by:
isResetOrFailed
in interfaceIStream
- Returns:
- whether this stream has been reset (locally or remotely) or has been failed
- See Also:
-
isClosed
public boolean isClosed() -
isRemotelyClosed
public boolean isRemotelyClosed()- Specified by:
isRemotelyClosed
in interfaceIStream
- Returns:
- whether the stream is closed remotely.
- See Also:
-
failAllData
Description copied from interface:IStream
Fail all data queued in the stream and reset demand to 0.- Specified by:
failAllData
in interfaceIStream
- Parameters:
x
- the exception to fail the data with.- Returns:
- true if the end of the stream was reached, false otherwise.
-
isLocallyClosed
public boolean isLocallyClosed() -
commit
public void commit()Description copied from interface:IStream
Marks this stream as committed. -
isCommitted
public boolean isCommitted()- Specified by:
isCommitted
in interfaceIStream
- Returns:
- whether bytes for this stream have been sent to the remote peer.
- See Also:
-
dataSize
public int dataSize() -
isOpen
public boolean isOpen() -
notIdle
public void notIdle()Description copied from interface:IStream
Marks this stream as not idle so that the
idle timeout
is postponed. -
getExpireNanoTime
public long getExpireNanoTime()Description copied from interface:CyclicTimeouts.Expirable
Returns the expiration time in nanoseconds.
The value to return must be calculated taking into account the current nanoTime, for example:
expireNanoTime = NanoTime.now() + timeoutNanos
Returning
Long.MAX_VALUE
indicates that this entity does not expire.- Specified by:
getExpireNanoTime
in interfaceCyclicTimeouts.Expirable
- Returns:
- the expiration time in nanoseconds, or
Long.MAX_VALUE
if this entity does not expire
-
getIdleTimeout
public long getIdleTimeout()- Specified by:
getIdleTimeout
in interfaceStream
- Returns:
- the stream idle timeout
- See Also:
-
setIdleTimeout
public void setIdleTimeout(long idleTimeout) - Specified by:
setIdleTimeout
in interfaceStream
- Parameters:
idleTimeout
- the stream idle timeout- See Also:
-
onIdleExpired
-
getListener
- Specified by:
getListener
in interfaceIStream
- Returns:
- the
Stream.Listener
associated with this stream - See Also:
-
setListener
- Specified by:
setListener
in interfaceIStream
- Parameters:
listener
- theStream.Listener
associated with this stream- See Also:
-
process
Description copied from interface:IStream
Processes the given
frame
, belonging to this stream. -
demand
public void demand(long n) Description copied from interface:Stream
Demands
n
moreDATA
frames for this stream. -
updateClose
Description copied from interface:IStream
Updates the close state of this stream.
- Specified by:
updateClose
in interfaceIStream
- Parameters:
update
- whether to update the close stateevent
- the event that caused the close state update- Returns:
- whether the stream has been fully closed by this invocation
-
getSendWindow
public int getSendWindow() -
getRecvWindow
public int getRecvWindow() -
updateSendWindow
public int updateSendWindow(int delta) Description copied from interface:IStream
Updates the stream send window by the given
delta
.- Specified by:
updateSendWindow
in interfaceIStream
- Parameters:
delta
- the delta value (positive or negative) to add to the stream send window- Returns:
- the previous value of the stream send window
-
updateRecvWindow
public int updateRecvWindow(int delta) Description copied from interface:IStream
Updates the stream receive window by the given
delta
.- Specified by:
updateRecvWindow
in interfaceIStream
- Parameters:
delta
- the delta value (positive or negative) to add to the stream receive window- Returns:
- the previous value of the stream receive window
-
close
public void close()Description copied from interface:IStream
Forcibly closes this stream.
-
onClose
public void onClose() -
succeeded
public void succeeded()Description copied from interface:Callback
Callback invoked when the operation completes.
-
failed
Description copied from interface:Callback
Callback invoked when the operation fails.
-
getInvocationType
- Specified by:
getInvocationType
in interfaceInvocable
- Returns:
- The InvocationType of this object
-
dump
-
dump
Description copied from interface:Dumpable
Dump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.- Specified by:
dump
in interfaceDumpable
- Parameters:
out
- The appendable to dump toindent
- The indent to apply after any new lines.- Throws:
IOException
- if unable to write to Appendable
-
toString
-