Top Inners Fields Constructors Methods
org.eclipse.jetty.http2.server

public Class HTTP2ServerConnectionFactory

extends AbstractHTTP2ServerConnectionFactory
implements CipherDiscriminator
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.server.NegotiatingServerConnection.CipherDiscriminator
Known Direct Subclasses
org.eclipse.jetty.http2.server.HTTP2CServerConnectionFactory
Imports
java.util.Map, java.util.concurrent.TimeoutException, org.eclipse.jetty.http2.ErrorCode, .HTTP2Cipher, .HTTP2Stream, org.eclipse.jetty.http2.api.Session, .Stream, org.eclipse.jetty.http2.api.server.ServerSessionListener, org.eclipse.jetty.http2.frames.GoAwayFrame, .HeadersFrame, .PushPromiseFrame, .ResetFrame, org.eclipse.jetty.http2.server.internal.HTTP2ServerConnection, org.eclipse.jetty.io.EndPoint, .EofException, .QuietException, org.eclipse.jetty.server.Connector, .HttpConfiguration, .NegotiatingServerConnection.CipherDiscriminator, org.eclipse.jetty.util.Callback, .Promise, .StringUtil, org.eclipse.jetty.util.annotation.Name, org.slf4j.Logger, .LoggerFactory

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected class

Field Summary

Modifier and TypeField and Description
private static final Logger

Constructor Summary

AccessConstructor and Description
public
public
HTTP2ServerConnectionFactory(HttpConfiguration httpConfiguration, String... protocols)

Method Summary

Modifier and TypeMethod and Description
public boolean
protected ServerSessionListener
Inherited from org.eclipse.jetty.http2.server.AbstractHTTP2ServerConnectionFactory:
getFlowControlStrategyFactorygetHttpConfigurationgetInitialSessionRecvWindowgetInitialStreamRecvWindowgetMaxConcurrentStreamsgetMaxDecoderTableCapacitygetMaxEncoderTableCapacitygetMaxFrameSizegetMaxHeaderBlockFragmentgetMaxSettingsKeysgetRateControlFactorygetStreamIdleTimeoutisConnectProtocolEnabledisUseInputDirectByteBuffersisUseOutputDirectByteBuffersnewConnectionnewSettingssetConnectProtocolEnabledsetFlowControlStrategyFactorysetInitialSessionRecvWindowsetInitialStreamRecvWindowsetMaxConcurrentStreamssetMaxDecoderTableCapacitysetMaxEncoderTableCapacitysetMaxFrameSizesetMaxHeaderBlockFragmentsetMaxSettingsKeyssetRateControlFactorysetStreamIdleTimeoutsetUseInputDirectByteBufferssetUseOutputDirectByteBuffers

Field Detail

LOGback to summary
private static final Logger LOG

Hides org.eclipse.jetty.util.component.ContainerLifeCycle.LOG.

Constructor Detail

HTTP2ServerConnectionFactoryback to summary
public HTTP2ServerConnectionFactory(HttpConfiguration httpConfiguration)
HTTP2ServerConnectionFactoryback to summary
public HTTP2ServerConnectionFactory(HttpConfiguration httpConfiguration, String... protocols)

Method Detail

isAcceptableback to summary
public boolean isAcceptable(String protocol, String tlsProtocol, String tlsCipher)

Implements org.eclipse.jetty.server.NegotiatingServerConnection.CipherDiscriminator.isAcceptable.

Annotations
@Override
newSessionListenerback to summary
protected ServerSessionListener newSessionListener(Connector connector, EndPoint endPoint)

Implements abstract org.eclipse.jetty.http2.server.AbstractHTTP2ServerConnectionFactory.newSessionListener.

Annotations
@Override
org.eclipse.jetty.http2.server back to summary

protected Class HTTP2ServerConnectionFactory.HTTPServerSessionListener

extends Object
implements ServerSessionListener, Listener
Class Inheritance
  • java.lang.Object
  • org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory.HTTPServerSessionListener
All Implemented Interfaces
org.eclipse.jetty.http2.api.Stream.Listener, org.eclipse.jetty.http2.api.server.ServerSessionListener, org.eclipse.jetty.http2.api.Session.Listener

Field Summary

Modifier and TypeField and Description
private final EndPoint

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
close(Stream stream, String reason)

private HTTP2ServerConnection
public void
onClose(Session
the session
session
,
GoAwayFrame
the GOAWAY frame that caused the session to be closed
frame
,
Callback
the callback to notify of the GOAWAY processing
callback
)

Overrides default org.eclipse.jetty.http2.api.Session.Listener.onClose.

Callback method invoked when a GOAWAY frame caused the session to be closed.

public void
onDataAvailable(Stream
the stream
stream
)

Overrides default org.eclipse.jetty.http2.api.Stream.Listener.onDataAvailable.

Callback method invoked if the application has expressed demand for DATA frames, and if there may be content available.

public void
onFailure(Session
the session
session
,
Throwable
the failure
failure
,
Callback
the callback to notify of failure processing
callback
)

Overrides default org.eclipse.jetty.http2.api.Session.Listener.onFailure.

Callback method invoked when a failure has been detected for this session.

public void
onFailure(Stream
the stream
stream
,
int
the error code
error
,
String
the error reason, or null
reason
,
Throwable
the failure
failure
,
Callback
the callback to complete when the failure has been handled
callback
)

Overrides default org.eclipse.jetty.http2.api.Stream.Listener.onFailure.

Callback method invoked when the stream failed.

private void
onFailure(Stream stream, Throwable failure, Callback callback)

public void
onHeaders(Stream
the stream
stream
,
HeadersFrame
the HEADERS frame received
frame
)

Overrides default org.eclipse.jetty.http2.api.Stream.Listener.onHeaders.

Callback method invoked when a HEADERS frame representing the HTTP response has been received.

public boolean
onIdleTimeout(Session
the session
session
)

Overrides default org.eclipse.jetty.http2.api.Session.Listener.onIdleTimeout.

Callback method invoked when the idle timeout expired.

public void
onIdleTimeout(Stream
the stream
stream
,
TimeoutException
the timeout failure
x
,
Promise<Boolean>
the promise to complete
promise
)

Overrides default org.eclipse.jetty.http2.api.Stream.Listener.onIdleTimeout.

Callback method invoked when the stream exceeds its idle timeout.

public Stream.Listener
onNewStream(Stream
the newly created stream
stream
,
HeadersFrame
the HEADERS frame received
frame
)

Overrides default org.eclipse.jetty.http2.api.Session.Listener.onNewStream.

Callback method invoked when a new stream is being created upon receiving a HEADERS frame representing an HTTP request.

public Map<Integer, Integer>
onPreface(Session
the session
session
)

Overrides default org.eclipse.jetty.http2.api.Session.Listener.onPreface.

Callback method invoked:

  • for clients, just before the preface is sent, to gather the SETTINGS configuration options the client wants to send to the server;
  • for servers, just after having received the preface, to gather the SETTINGS configuration options the server wants to send to the client.
public Stream.Listener
onPush(Stream
the pushed stream
stream
,
PushPromiseFrame
the PUSH_PROMISE frame received
frame
)

Overrides default org.eclipse.jetty.http2.api.Stream.Listener.onPush.

Callback method invoked when a PUSH_PROMISE frame has been received.

public void
onReset(Stream
the stream
stream
,
ResetFrame
the RST_STREAM frame received
frame
,
Callback
the callback to complete when the reset has been handled
callback
)

Overrides default org.eclipse.jetty.http2.api.Stream.Listener.onReset.

Callback method invoked when a RST_STREAM frame has been received for this stream.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

endPointback to summary
private final EndPoint endPoint

Constructor Detail

HTTPServerSessionListenerback to summary
public HTTPServerSessionListener(EndPoint endPoint)

Method Detail

closeback to summary
private void close(Stream stream, String reason)
getConnectionback to summary
private HTTP2ServerConnection getConnection()
onCloseback to summary
public void onClose(Session session, GoAwayFrame frame, Callback callback)

Overrides default org.eclipse.jetty.http2.api.Session.Listener.onClose.

Doc from org.eclipse.jetty.http2.api.Session.Listener.onClose.

Callback method invoked when a GOAWAY frame caused the session to be closed.

Parameters
session:Session

the session

frame:GoAwayFrame

the GOAWAY frame that caused the session to be closed

callback:Callback

the callback to notify of the GOAWAY processing

Annotations
@Override
onDataAvailableback to summary
public void onDataAvailable(Stream stream)

Overrides default org.eclipse.jetty.http2.api.Stream.Listener.onDataAvailable.

Doc from org.eclipse.jetty.http2.api.Stream.Listener.onDataAvailable.

Callback method invoked if the application has expressed demand for DATA frames, and if there may be content available.

Applications that wish to handle DATA frames should call Stream#demand() for this method to be invoked when the data is available.

Server applications should typically demand from onNewStream(Stream) (upon receiving an HTTP request), while client applications should typically demand from onHeaders(Stream, HeadersFrame) (upon receiving an HTTP response).

Just prior calling this method, the outstanding demand is cancelled; applications that implement this method should read content calling Stream#readData(), and call Stream#demand() to signal to the implementation to call again this method when there may be more content available.

Only one thread at a time invokes this method, although it may not be the same thread across different invocations.

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

Typical usage:

class MyStreamListener implements Stream.Listener
{
    @Override
    public void onDataAvailable(Stream stream)
    {
        // Read a chunk of the content.
        Stream.Data data = stream.readData();
        if (data == null)
        {
            // No data available now, demand to be called back.
            stream.demand();
        }
        else
        {
            // Process the content.
            process(data.frame().getByteBuffer());
            // Notify that the content has been consumed.
            data.release();
            if (!data.frame().isEndStream())
            {
                // Demand to be called back.
                stream.demand();
            }
        }
    }
}
Parameters
stream:Stream

the stream

Annotations
@Override
onFailureback to summary
public void onFailure(Session session, Throwable failure, Callback callback)

Overrides default org.eclipse.jetty.http2.api.Session.Listener.onFailure.

Doc from org.eclipse.jetty.http2.api.Session.Listener.onFailure.

Callback method invoked when a failure has been detected for this session.

Parameters
session:Session

the session

failure:Throwable

the failure

callback:Callback

the callback to notify of failure processing

Annotations
@Override
onFailureback to summary
public void onFailure(Stream stream, int error, String reason, Throwable failure, Callback callback)

Overrides default org.eclipse.jetty.http2.api.Stream.Listener.onFailure.

Doc from org.eclipse.jetty.http2.api.Stream.Listener.onFailure.

Callback method invoked when the stream failed.

Parameters
stream:Stream

the stream

error:int

the error code

reason:String

the error reason, or null

failure:Throwable

the failure

callback:Callback

the callback to complete when the failure has been handled

Annotations
@Override
onFailureback to summary
private void onFailure(Stream stream, Throwable failure, Callback callback)
onHeadersback to summary
public void onHeaders(Stream stream, HeadersFrame frame)

Overrides default org.eclipse.jetty.http2.api.Stream.Listener.onHeaders.

Doc from org.eclipse.jetty.http2.api.Stream.Listener.onHeaders.

Callback method invoked when a HEADERS frame representing the HTTP response has been received.

Parameters
stream:Stream

the stream

frame:HeadersFrame

the HEADERS frame received

Annotations
@Override
onIdleTimeoutback to summary
public boolean onIdleTimeout(Session session)

Overrides default org.eclipse.jetty.http2.api.Session.Listener.onIdleTimeout.

Doc from org.eclipse.jetty.http2.api.Session.Listener.onIdleTimeout.

Callback method invoked when the idle timeout expired.

Parameters
session:Session

the session

Returns:boolean

whether the session should be closed

Annotations
@Override
onIdleTimeoutback to summary
public void onIdleTimeout(Stream stream, TimeoutException x, Promise<Boolean> promise)

Overrides default org.eclipse.jetty.http2.api.Stream.Listener.onIdleTimeout.

Doc from org.eclipse.jetty.http2.api.Stream.Listener.onIdleTimeout.

Callback method invoked when the stream exceeds its idle timeout.

Parameters
stream:Stream

the stream

x:TimeoutException

the timeout failure

promise:Promise<Boolean>

the promise to complete

Annotations
@Override
onNewStreamback to summary
public Stream.Listener onNewStream(Stream stream, HeadersFrame frame)

Overrides default org.eclipse.jetty.http2.api.Session.Listener.onNewStream.

Doc from org.eclipse.jetty.http2.api.Session.Listener.onNewStream.

Callback method invoked when a new stream is being created upon receiving a HEADERS frame representing an HTTP request.

Applications should implement this method to process HTTP requests, typically providing an HTTP response via Stream#headers(HeadersFrame, Callback).

Applications can detect whether request DATA frames will be arriving by testing HeadersFrame#isEndStream(). If the application is interested in processing the DATA frames, it must demand for DATA frames using Stream#demand() and then return either a Stream.Listener implementation that overrides Stream.Listener#onDataAvailable(Stream) where applications can read from the Stream via Stream#readData(), or Stream.Listener#AUTO_DISCARD that automatically reads and discards DATA frames. Returning null is possible but discouraged, and has the same effect of demanding and discarding the DATA frames.

Parameters
stream:Stream

the newly created stream

frame:HeadersFrame

the HEADERS frame received

Returns:Stream.Listener

a Stream.Listener that will be notified of stream events

Annotations
@Override
onPrefaceback to summary
public Map<Integer, Integer> onPreface(Session session)

Overrides default org.eclipse.jetty.http2.api.Session.Listener.onPreface.

Doc from org.eclipse.jetty.http2.api.Session.Listener.onPreface.

Callback method invoked:

  • for clients, just before the preface is sent, to gather the SETTINGS configuration options the client wants to send to the server;
  • for servers, just after having received the preface, to gather the SETTINGS configuration options the server wants to send to the client.
Parameters
session:Session

the session

Returns:Map<Integer, Integer>

a (possibly empty or null) map containing SETTINGS configuration options to send.

Annotations
@Override
onPushback to summary
public Stream.Listener onPush(Stream stream, PushPromiseFrame frame)

Overrides default org.eclipse.jetty.http2.api.Stream.Listener.onPush.

Doc from org.eclipse.jetty.http2.api.Stream.Listener.onPush.

Callback method invoked when a PUSH_PROMISE frame has been received.

Applications that override this method are typically interested in processing the pushed stream DATA frames, and must demand for pushed DATA frames via Stream#demand() and then return either a Listener implementation that overrides onDataAvailable(Stream) where applications can read from the Stream via Stream#readData(), or AUTO_DISCARD that automatically reads and discards DATA frames. Returning null is possible but discouraged, and has the same effect of demanding and discarding the pushed DATA frames.

Parameters
stream:Stream

the pushed stream

frame:PushPromiseFrame

the PUSH_PROMISE frame received

Returns:Stream.Listener

a Stream.Listener that will be notified of pushed stream events

Annotations
@Override
onResetback to summary
public void onReset(Stream stream, ResetFrame frame, Callback callback)

Overrides default org.eclipse.jetty.http2.api.Stream.Listener.onReset.

Doc from org.eclipse.jetty.http2.api.Stream.Listener.onReset.

Callback method invoked when a RST_STREAM frame has been received for this stream.

Parameters
stream:Stream

the stream

frame:ResetFrame

the RST_STREAM frame received

callback:Callback

the callback to complete when the reset has been handled

Annotations
@Override