Class HttpStreamOverHTTP2
- All Implemented Interfaces:
HTTP2Channel.Server
,HttpStream
,Callback
,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.server.HttpStream
HttpStream.Wrapper
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable
Invocable.Callable, Invocable.InvocationType, Invocable.ReadyTask, Invocable.Task
-
Field Summary
Fields inherited from interface org.eclipse.jetty.server.HttpStream
CONTENT_NOT_CONSUMED, UPGRADE_CONNECTION_ATTRIBUTE
Fields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking
-
Constructor Summary
ConstructorDescriptionHttpStreamOverHTTP2
(HTTP2ServerConnection connection, HttpChannel httpChannel, HTTP2Stream stream) -
Method Summary
Modifier and TypeMethodDescriptionvoid
demand()
Demands more content chunks to the underlying implementation.void
Callback invoked when the operation fails.getId()
long
boolean
boolean
isIdle()
onPushRequest
(MetaData.Request request) onRequest
(HeadersFrame frame) void
onTimeout
(TimeoutException timeout, BiConsumer<Runnable, Boolean> consumer) onTrailer
(HeadersFrame frame) void
prepareResponse
(HttpFields.Mutable headers) Prepare the response headers with respect to the stream.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 byteBuffer, Callback callback) Send response meta-data and/or data.void
setIdleTimeout
(long idleTimeoutMs) void
Callback invoked when the operation completes.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.util.Callback
completeWith
Methods inherited from interface org.eclipse.jetty.server.HttpStream
getInvocationType
-
Constructor Details
-
HttpStreamOverHTTP2
public HttpStreamOverHTTP2(HTTP2ServerConnection connection, HttpChannel httpChannel, HTTP2Stream stream)
-
-
Method Details
-
getId
- Specified by:
getId
in interfaceHttpStream
- 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.
-
onRequest
-
read
Description copied from interface:HttpStream
Reads a chunk of content, with the same semantic as
Content.Source.read()
.This method is called from the implementation of
Request.read()
.- Specified by:
read
in interfaceHttpStream
- Returns:
- a chunk of content, possibly with non-null
Content.Chunk.getFailure()
ornull
.
-
demand
public void demand()Description copied from interface:HttpStream
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)
.- Specified by:
demand
in interfaceHttpStream
- See Also:
-
onDataAvailable
- Specified by:
onDataAvailable
in interfaceHTTP2Channel.Server
-
onTrailer
- Specified by:
onTrailer
in interfaceHTTP2Channel.Server
-
prepareResponse
Description copied from interface:HttpStream
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).- Specified by:
prepareResponse
in interfaceHttpStream
- Parameters:
headers
- The headers to prepare.
-
send
public void send(MetaData.Request request, MetaData.Response response, boolean last, ByteBuffer byteBuffer, Callback callback) Description copied from interface:HttpStream
Send response meta-data and/or data.
- Specified by:
send
in interfaceHttpStream
- 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.byteBuffer
- 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.
-
getIdleTimeout
public long getIdleTimeout()- Specified by:
getIdleTimeout
in interfaceHttpStream
-
setIdleTimeout
public void setIdleTimeout(long idleTimeoutMs) - Specified by:
setIdleTimeout
in interfaceHttpStream
-
push
Description copied from interface:HttpStream
Pushes the given
resource
to the client.- Specified by:
push
in interfaceHttpStream
- Parameters:
resource
- the resource to push- See Also:
-
onPushRequest
-
isCommitted
public boolean isCommitted()- Specified by:
isCommitted
in interfaceHttpStream
-
isIdle
public boolean isIdle()- Specified by:
isIdle
in interfaceHTTP2Channel.Server
-
getTunnelSupport
- Specified by:
getTunnelSupport
in interfaceHttpStream
-
consumeAvailable
- Specified by:
consumeAvailable
in interfaceHttpStream
-
onTimeout
- Specified by:
onTimeout
in interfaceHTTP2Channel.Server
-
onFailure
- Specified by:
onFailure
in interfaceHTTP2Channel.Server
-
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.
-