Interface HttpStream
- All Known Implementing Classes:
CompletionStreamWrapper
,HttpConnection.HttpStreamOverHTTP1
,HttpStream.Wrapper
,HttpStreamOverFCGI
,HttpStreamOverHTTP2
MetaData.Request
, represents the
flow of data from and to a single request and response cycle. It is roughly analogous to the
Stream within an HTTP/2 connection, in that a connection can have many streams, each used once
and each representing a single request and response exchange.-
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.thread.Invocable
Invocable.Callable, Invocable.InvocationType, Invocable.ReadyTask, Invocable.Task
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Exception
static final String
Attribute name to be used as aRequest
attribute to store/retrieve theConnection
created during the HTTP/1.1 upgrade mechanism or the HTTP/2 tunnel mechanism.Fields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking
-
Method Summary
Modifier and TypeMethodDescriptionstatic Throwable
consumeAvailable
(HttpStream stream, HttpConfiguration httpConfig) void
demand()
Demands more content chunks to the underlying implementation.getId()
long
default Invocable.InvocationType
default TunnelSupport
boolean
void
prepareResponse
(HttpFields.Mutable headers) Prepare the response headers with respect to the stream.default void
push
(MetaData.Request resource) Pushes the givenresource
to the client.read()
Reads a chunk of content, with the same semantic asContent.Source.read()
.void
send
(MetaData.Request request, MetaData.Response response, boolean last, ByteBuffer content, Callback callback) Send response meta-data and/or data.void
setIdleTimeout
(long idleTimeoutMs) Methods inherited from interface org.eclipse.jetty.util.Callback
completeWith, failed, succeeded
-
Field Details
-
CONTENT_NOT_CONSUMED
-
UPGRADE_CONNECTION_ATTRIBUTE
Attribute name to be used as a
Request
attribute to store/retrieve theConnection
created during the HTTP/1.1 upgrade mechanism or the HTTP/2 tunnel mechanism.
-
-
Method Details
-
getId
String getId()- Returns:
- an ID unique within the lifetime scope of the associated protocol connection. This may be a protocol ID (e.g. HTTP/2 stream ID) or it may be unrelated to the protocol.
-
read
Content.Chunk read()Reads a chunk of content, with the same semantic as
Content.Source.read()
.This method is called from the implementation of
Request.read()
.- Returns:
- a chunk of content, possibly with non-null
Content.Chunk.getFailure()
ornull
.
-
demand
void demand()Demands more content chunks to the underlying implementation.
This method is called from the implementation of
Request.demand(Runnable)
and when the demand can be satisfied the implementation must callHttpChannel.onContentAvailable()
. If there is a problem meeting demand, then the implementation must callHttpChannel.onFailure(Throwable)
. -
prepareResponse
Prepare the response headers with respect to the stream. Typically this may set headers related to protocol specific behaviour (e.g.
Keep-Alive
for HTTP/1.0 connections).- Parameters:
headers
- The headers to prepare.
-
send
void send(MetaData.Request request, MetaData.Response response, boolean last, ByteBuffer content, Callback callback) Send response meta-data and/or data.
- Parameters:
request
- The request metadata for which the response should be sent.response
- The response metadata to be sent or null if the response is already committed by a previous call to send.last
- True if this will be the last call to send and the response can be completed.content
- A buffer of content to send or null if no content.callback
- The callback to invoke when the send is completed successfully or in failure.
-
push
Pushes the given
resource
to the client.- Parameters:
resource
- the resource to push- Throws:
UnsupportedOperationException
- if the push functionality is not supported- See Also:
-
getIdleTimeout
long getIdleTimeout() -
setIdleTimeout
void setIdleTimeout(long idleTimeoutMs) -
isCommitted
boolean isCommitted() -
getTunnelSupport
-
consumeAvailable
Throwable consumeAvailable() -
consumeAvailable
-
getInvocationType
- Specified by:
getInvocationType
in interfaceInvocable
- Returns:
- The InvocationType of this object
-