public abstract class SpdyOrHttpChooser extends java.lang.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.限定符和类型 | 类和说明 |
---|---|
static class |
SpdyOrHttpChooser.SelectedProtocol |
ChannelHandler.Sharable
限定符 | 构造器和说明 |
---|---|
protected |
SpdyOrHttpChooser(int maxSpdyContentLength,
int maxHttpContentLength) |
protected SpdyOrHttpChooser(int maxSpdyContentLength, int maxHttpContentLength)
protected abstract SpdyOrHttpChooser.SelectedProtocol getProtocol(javax.net.ssl.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 java.lang.Exception
ChannelUpstreamHandler
handleUpstream
在接口中 ChannelUpstreamHandler
ctx
- the context object for this handlere
- the upstream event to process or interceptjava.lang.Exception
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.