public abstract class SpdyOrHttpChooser extends Object implements ChannelUpstreamHandler
ChannelUpstreamHandler
which is responsible to setup the ChannelPipeline
either for
HTTP or SPDY. This offers an easy way for users to support both at the same time while not care to
much about the low-level details.Modifier and Type | Class and Description |
---|---|
static class |
SpdyOrHttpChooser.SelectedProtocol |
ChannelHandler.Sharable
Modifier | Constructor and Description |
---|---|
protected |
SpdyOrHttpChooser(int maxSpdyContentLength,
int maxHttpContentLength) |
protected SpdyOrHttpChooser(int maxSpdyContentLength, int maxHttpContentLength)
protected abstract SpdyOrHttpChooser.SelectedProtocol getProtocol(SSLEngine engine)
SpdyOrHttpChooser.SelectedProtocol
for the SSLEngine
. If its not known yet implementations
MUST return SpdyOrHttpChooser.SelectedProtocol.None
.public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception
ChannelUpstreamHandler
handleUpstream
in interface ChannelUpstreamHandler
ctx
- the context object for this handlere
- the upstream event to process or interceptException
protected void addSpdyHandlers(ChannelHandlerContext ctx, SpdyVersion version)
ChannelHandler
's that are needed for SPDY with the given version.protected void addHttpHandlers(ChannelHandlerContext ctx)
ChannelHandler
's that are needed for HTTP.protected abstract ChannelUpstreamHandler createHttpRequestHandlerForHttp()
ChannelUpstreamHandler
that is responsible for handling the HttpRequest
's
when the SpdyOrHttpChooser.SelectedProtocol
was SpdyOrHttpChooser.SelectedProtocol.HttpVersion1_0
or
SpdyOrHttpChooser.SelectedProtocol.HttpVersion1_1
protected ChannelUpstreamHandler createHttpRequestHandlerForSpdy()
ChannelUpstreamHandler
that is responsible for handling the HttpRequest
's
when the SpdyOrHttpChooser.SelectedProtocol
was SpdyOrHttpChooser.SelectedProtocol.SpdyVersion3_1
.
By default this method will just delecate to createHttpRequestHandlerForHttp()
, but
sub-classes may override this to change the behaviour.Copyright © 2008-2016 The Netty Project. All Rights Reserved.