Class HTTP3Stream
- All Implemented Interfaces:
Stream
,CyclicTimeouts.Expirable
,Attachable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static enum
Defines the state of the stream for received frames,Nested classes/interfaces inherited from interface org.eclipse.jetty.http3.api.Stream
Stream.Client, Stream.Server
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
data
(DataFrame frame, Promise.Invocable<Stream> promise) Sends the given DATA frame containing some or all the bytes of the request content or of the response content.void
demand()
Demands moreDATA
frames for this stream.void
disconnect
(long appErrorCode, Throwable failure, Promise.Invocable<Stream> promise) Abruptly terminates this stream with the given error.long
Returns the expiration time in nanoseconds.long
getId()
Get the stream id.long
Get the session this stream is associated to.boolean
boolean
isClosed()
boolean
isLocal()
protected void
notIdle()
protected abstract void
abstract void
notifyFailure
(long error, Throwable failure) protected abstract void
notifyIdleTimeout
(TimeoutException timeout, Promise<Boolean> promise) protected abstract void
notifyTrailer
(HeadersFrame frame) void
void
void
onHeaders
(HeadersFrame frame) void
onTrailer
(HeadersFrame frame) read()
Reads request content bytes or response content bytes.void
setAttachment
(Object attachment) Attaches the given object to this stream for later retrieval.void
setIdleTimeout
(long idleTimeout) toString()
void
trailer
(HeadersFrame frame, Promise.Invocable<Stream> promise) Sends the given HEADERS frame containing the trailer headers.void
updateClose
(boolean update, boolean local) protected void
validateAndUpdate
(EnumSet<HTTP3Stream.FrameState> allowed, HTTP3Stream.FrameState target) protected void
write
(Frame frame, Promise.Invocable<Stream> promise) void
writeFrame
(Frame frame, Promise.Invocable<Stream> promise)
-
Constructor Details
-
HTTP3Stream
-
-
Method Details
-
getStreamEndPoint
-
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
-
getId
-
getSession
Description copied from interface:Stream
Get the session this stream is associated to.- Specified by:
getSession
in interfaceStream
- Returns:
- the session this stream is associated to
-
isLocal
public boolean isLocal() -
getIdleTimeout
public long getIdleTimeout() -
setIdleTimeout
public void setIdleTimeout(long idleTimeout) -
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
-
notIdle
protected void notIdle() -
data
Description copied from interface:Stream
Sends the given DATA frame containing some or all the bytes of the request content or of the response content.
- Specified by:
data
in interfaceStream
- Parameters:
frame
- the DATA frame containing some or all the bytes of the request or of the response.promise
- thePromise.Invocable
that gets notified when the frame has been sent
-
write
-
read
Description copied from interface:Stream
Reads request content bytes or response content bytes.
The returned
Content.Chunk
object may benull
, indicating that the end of the read side of the stream has not yet been reached, which may happen in these cases:- not all the bytes have been received so far, for example the remote peer did not send them yet, or they are in-flight
- all the bytes have been received, but there is a trailer HEADERS frame to be received to indicate the end of the read side of the stream
When the returned
Content.Chunk
object is notnull
, applications must call, either immediately or later (possibly asynchronously)Retainable.release()
to notify the implementation that the bytes have been processed.Content.Chunk
objects may be stored away for later, asynchronous, processing (for example, to process them only when all of them have been received).- Specified by:
read
in interfaceStream
- Returns:
- a
Content.Chunk
object containing the request bytes or the response bytes or a failure, or null if no bytes are available - See Also:
-
demand
public void demand()Description copied from interface:Stream
Demands more
DATA
frames for this stream.Calling this method causes
Stream.Client.Listener.onDataAvailable(Stream.Client)
on the client, orStream.Server.Listener.onDataAvailable(Stream.Server)
on the server, to be invoked, possibly at a later time, when the stream has data to be read, but also when the stream has reached EOF.This method is idempotent: calling it when there already is an outstanding demand to invoke
onDataAvailable(Stream)
is a no-operation.The thread invoking this method may invoke directly
onDataAvailable(Stream)
, unless another thread that must invokeonDataAvailable(Stream)
notices the outstanding demand first.It is always guaranteed that invoking this method from within
onDataAvailable(Stream)
will not cause aStackOverflowError
. -
trailer
Description copied from interface:Stream
Sends the given HEADERS frame containing the trailer headers.
- Specified by:
trailer
in interfaceStream
- Parameters:
frame
- the HEADERS frame containing the trailer headerspromise
- thePromise.Invocable
that gets notified when the frame has been sent
-
hasDemand
public boolean hasDemand() -
onHeaders
-
onData
-
notifyDataAvailable
protected abstract void notifyDataAvailable() -
onTrailer
-
notifyTrailer
-
notifyIdleTimeout
-
onFailure
-
notifyFailure
-
validateAndUpdate
protected void validateAndUpdate(EnumSet<HTTP3Stream.FrameState> allowed, HTTP3Stream.FrameState target) -
writeFrame
-
isClosed
public boolean isClosed() -
updateClose
public void updateClose(boolean update, boolean local) -
disconnect
Description copied from interface:Stream
Abruptly terminates this stream with the given error.
This method removes this stream from its session and then terminates the QUIC stream, via
STOP_SENDING
andRESET
frames, if necessary.- Specified by:
disconnect
in interfaceStream
- Parameters:
appErrorCode
- the error codefailure
- the failure that caused the close of the stream, if anypromise
- thePromise.Invocable
that gets notified when the disconnect is complete
-
toString
-