Top Inners Fields Constructors Methods
org.eclipse.jetty.http3

public abstract Class HTTP3Stream

extends Object
implements Stream, Expirable, Attachable
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.util.Attachable, org.eclipse.jetty.io.CyclicTimeouts.Expirable, org.eclipse.jetty.http3.api.Stream
Imports
java.util.EnumSet, java.util.concurrent.CompletableFuture, .TimeUnit, .TimeoutException, java.util.concurrent.atomic.AtomicReference, org.eclipse.jetty.http3.api.Stream, org.eclipse.jetty.http3.frames.DataFrame, .Frame, .HeadersFrame, org.eclipse.jetty.io.CyclicTimeouts, org.eclipse.jetty.quic.common.QuicStreamEndPoint, org.eclipse.jetty.util.Attachable, .Callback, .NanoTime, .Promise, org.eclipse.jetty.util.thread.AutoLock, .Invocable, org.slf4j.Logger, .LoggerFactory

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum
protected static enum
HTTP3Stream.FrameState

Defines the state of the stream for received frames,

allowing to verify that a frame sequence is valid for the HTTP protocol.

Field Summary

Modifier and TypeField and Description
private Object
private HTTP3Stream.CloseState
private boolean
private boolean
private boolean
private final AtomicReference<Stream.Data>
private boolean
private final QuicStreamEndPoint
private long
private HTTP3Stream.FrameState
private long
private final boolean
private final AutoLock
private static final Logger
private final HTTP3Session

Constructor Summary

AccessConstructor and Description
public
HTTP3Stream(HTTP3Session session, QuicStreamEndPoint endPoint, boolean local)

Method Summary

Modifier and TypeMethod and Description
public CompletableFuture<Stream>
data(DataFrame frame)

Implements org.eclipse.jetty.http3.api.Stream.data.

Sends the given DATA frame containing some or all the bytes of the request content or of the response content.

public void
demand()

Implements org.eclipse.jetty.http3.api.Stream.demand.

Demands more DATA frames for this stream.

public Object
public QuicStreamEndPoint
public long
getExpireNanoTime()

Implements org.eclipse.jetty.io.CyclicTimeouts.Expirable.getExpireNanoTime.

Returns the expiration time in nanoseconds.

public long
getId()

Implements org.eclipse.jetty.http3.api.Stream.getId.

Get the stream id.

public long
public HTTP3Session
getSession()

Implements org.eclipse.jetty.http3.api.Stream.getSession.

Get the session this stream is associated to.

public boolean
protected boolean
public boolean
private boolean
public boolean
private boolean
protected void
protected abstract void
protected abstract void
notifyFailure(long error, Throwable failure)

protected abstract void
protected abstract void
public void
onData(DataFrame ignored)

public void
private void
public void
onFailure(long error, Throwable failure)

public void
pack-priv void
public void
private void
private Stream.Data
read()

public Stream.Data
readData()

Implements org.eclipse.jetty.http3.api.Stream.readData.

Reads request content bytes or response content bytes.

public void
reset(long error, Throwable failure)

Implements org.eclipse.jetty.http3.api.Stream.reset.

Abruptly terminates this stream with the given error.

public void
setAttachment(Object attachment)

Implements org.eclipse.jetty.util.Attachable.setAttachment.

Attaches the given object to this stream for later retrieval.

public void
setIdleTimeout(long idleTimeout)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public CompletableFuture<Stream>
trailer(HeadersFrame frame)

Implements org.eclipse.jetty.http3.api.Stream.trailer.

Sends the given HEADERS frame containing the trailer headers.

public void
updateClose(boolean update, boolean local)

protected boolean
protected CompletableFuture<Stream>
write(Frame frame)

public Promise.Completable<Stream>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

attachmentback to summary
private Object attachment
closeStateback to summary
private HTTP3Stream.CloseState closeState
dataAvailableback to summary
private boolean dataAvailable
dataDemandback to summary
private boolean dataDemand
dataLastback to summary
private boolean dataLast
dataRefback to summary
private final AtomicReference<Stream.Data> dataRef
dataStalledback to summary
private boolean dataStalled
endPointback to summary
private final QuicStreamEndPoint endPoint
expireNanoTimeback to summary
private long expireNanoTime
frameStateback to summary
private HTTP3Stream.FrameState frameState
idleTimeoutback to summary
private long idleTimeout
localback to summary
private final boolean local
lockback to summary
private final AutoLock lock
LOGback to summary
private static final Logger LOG
sessionback to summary
private final HTTP3Session session

Constructor Detail

HTTP3Streamback to summary
public HTTP3Stream(HTTP3Session session, QuicStreamEndPoint endPoint, boolean local)

Method Detail

databack to summary
public CompletableFuture<Stream> data(DataFrame frame)

Implements org.eclipse.jetty.http3.api.Stream.data.

Doc from org.eclipse.jetty.http3.api.Stream.data.

Sends the given DATA frame containing some or all the bytes of the request content or of the response content.

Annotations
@Override
demandback to summary
public void demand()

Implements org.eclipse.jetty.http3.api.Stream.demand.

Doc from org.eclipse.jetty.http3.api.Stream.demand.

Demands more DATA frames for this stream.

Calling this method causes Stream.Client.Listener#onDataAvailable(Stream.Client) on the client, or Stream.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 invoke onDataAvailable(Stream) notices the outstanding demand first.

It is always guaranteed that invoking this method from within onDataAvailable(Stream) will not cause a StackOverflowError.

Annotations
@Override
getAttachmentback to summary
public Object getAttachment()

Implements org.eclipse.jetty.util.Attachable.getAttachment.

Annotations
@Override
getEndPointback to summary
public QuicStreamEndPoint getEndPoint()
getExpireNanoTimeback to summary
public long getExpireNanoTime()

Implements org.eclipse.jetty.io.CyclicTimeouts.Expirable.getExpireNanoTime.

Doc from org.eclipse.jetty.io.CyclicTimeouts.Expirable.getExpireNanoTime.

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.

Annotations
@Override
getIdback to summary
public long getId()

Implements org.eclipse.jetty.http3.api.Stream.getId.

Doc from org.eclipse.jetty.http3.api.Stream.getId.

Get the stream id.

Annotations
@Override
getIdleTimeoutback to summary
public long getIdleTimeout()
getSessionback to summary
public HTTP3Session getSession()

Implements org.eclipse.jetty.http3.api.Stream.getSession.

Doc from org.eclipse.jetty.http3.api.Stream.getSession.

Get the session this stream is associated to.

Annotations
@Override
hasDemandback to summary
public boolean hasDemand()
hasDemandOrStallback to summary
protected boolean hasDemandOrStall()
isClosedback to summary
public boolean isClosed()
isLastback to summary
private boolean isLast()
isLocalback to summary
public boolean isLocal()
isStalledback to summary
private boolean isStalled()
notIdleback to summary
protected void notIdle()
notifyDataAvailableback to summary
protected abstract void notifyDataAvailable()
notifyFailureback to summary
protected abstract void notifyFailure(long error, Throwable failure)
notifyIdleTimeoutback to summary
protected abstract void notifyIdleTimeout(TimeoutException timeout, Promise<Boolean> promise)
notifyTrailerback to summary
protected abstract void notifyTrailer(HeadersFrame frame)
onDataback to summary
public void onData(DataFrame ignored)
onDataback to summary
public void onData(Stream.Data data)
onDataAvailableback to summary
private void onDataAvailable()
onFailureback to summary
public void onFailure(long error, Throwable failure)
onHeadersback to summary
public void onHeaders(HeadersFrame frame)
onIdleTimeoutback to summary
pack-priv void onIdleTimeout(TimeoutException timeout, Promise<Boolean> promise)
onTrailerback to summary
public void onTrailer(HeadersFrame frame)
processDataback to summary
private void processData()
readback to summary
private Stream.Data read()
readDataback to summary
public Stream.Data readData()

Implements org.eclipse.jetty.http3.api.Stream.readData.

Doc from org.eclipse.jetty.http3.api.Stream.readData.

Reads request content bytes or response content bytes.

The returned Stream.Data object may be null, 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 Stream.Data object is not null, applications must call, either immediately or later (possibly asynchronously) Stream.Data#release() to notify the implementation that the bytes have been processed.

Stream.Data objects may be stored away for later, asynchronous, processing (for example, to process them only when all of them have been received).

Annotations
@Override
resetback to summary
public void reset(long error, Throwable failure)

Implements org.eclipse.jetty.http3.api.Stream.reset.

Doc from org.eclipse.jetty.http3.api.Stream.reset.

Abruptly terminates this stream with the given error.

Annotations
@Override
setAttachmentback to summary
public void setAttachment(Object attachment)

Implements org.eclipse.jetty.util.Attachable.setAttachment.

Doc from org.eclipse.jetty.util.Attachable.setAttachment.

Attaches the given object to this stream for later retrieval.

Annotations
@Override
setIdleTimeoutback to summary
public void setIdleTimeout(long idleTimeout)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
trailerback to summary
public CompletableFuture<Stream> trailer(HeadersFrame frame)

Implements org.eclipse.jetty.http3.api.Stream.trailer.

Doc from org.eclipse.jetty.http3.api.Stream.trailer.

Sends the given HEADERS frame containing the trailer headers.

Annotations
@Override
updateCloseback to summary
public void updateClose(boolean update, boolean local)
validateAndUpdateback to summary
protected boolean validateAndUpdate(EnumSet<HTTP3Stream.FrameState> allowed, HTTP3Stream.FrameState target)
writeback to summary
protected CompletableFuture<Stream> write(Frame frame)
writeFrameback to summary
public Promise.Completable<Stream> writeFrame(Frame frame)
org.eclipse.jetty.http3 back to summary

private final Enum HTTP3Stream.CloseState

extends Enum<HTTP3Stream.CloseState>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final HTTP3Stream.CloseState
public static final HTTP3Stream.CloseState
public static final HTTP3Stream.CloseState
public static final HTTP3Stream.CloseState

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static HTTP3Stream.CloseState
public static HTTP3Stream.CloseState[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

CLOSEDback to summary
public static final HTTP3Stream.CloseState CLOSED
LOCALLY_CLOSEDback to summary
public static final HTTP3Stream.CloseState LOCALLY_CLOSED
NOT_CLOSEDback to summary
public static final HTTP3Stream.CloseState NOT_CLOSED
REMOTELY_CLOSEDback to summary
public static final HTTP3Stream.CloseState REMOTELY_CLOSED

Constructor Detail

CloseStateback to summary
private CloseState()

Method Detail

valueOfback to summary
public static HTTP3Stream.CloseState valueOf(String name)
valuesback to summary
public static HTTP3Stream.CloseState[] values()
org.eclipse.jetty.http3 back to summary

protected final Enum HTTP3Stream.FrameState

extends Enum<HTTP3Stream.FrameState>
Class Inheritance

Defines the state of the stream for received frames,

allowing to verify that a frame sequence is valid for the HTTP protocol.

For example, for a stream in the INITIAL state, receiving a DataFrame would move the stream to the DATA state which would be invalid, since for the HTTP protocol a HeadersFrame is expected before any DataFrame.

Field Summary

Modifier and TypeField and Description
public static final HTTP3Stream.FrameState
DATA

The stream has received HTTP content.

public static final HTTP3Stream.FrameState
FAILED

The stream has encountered a failure.

public static final HTTP3Stream.FrameState
HEADER

The stream has received an HTTP final response.

public static final HTTP3Stream.FrameState
INFORMATIONAL

The stream has received an HTTP informational response.

public static final HTTP3Stream.FrameState
INITIAL

The initial state of the stream, before it receives any frame.

public static final HTTP3Stream.FrameState
TRAILER

The stream has received an HTTP trailer.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static HTTP3Stream.FrameState
public static HTTP3Stream.FrameState[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

DATAback to summary
public static final HTTP3Stream.FrameState DATA

The stream has received HTTP content.

FAILEDback to summary
public static final HTTP3Stream.FrameState FAILED

The stream has encountered a failure.

HEADERback to summary
public static final HTTP3Stream.FrameState HEADER

The stream has received an HTTP final response.

INFORMATIONALback to summary
public static final HTTP3Stream.FrameState INFORMATIONAL

The stream has received an HTTP informational response.

INITIALback to summary
public static final HTTP3Stream.FrameState INITIAL

The initial state of the stream, before it receives any frame.

TRAILERback to summary
public static final HTTP3Stream.FrameState TRAILER

The stream has received an HTTP trailer.

Constructor Detail

FrameStateback to summary
private FrameState()

Method Detail

valueOfback to summary
public static HTTP3Stream.FrameState valueOf(String name)
valuesback to summary
public static HTTP3Stream.FrameState[] values()