Class SpdyOrHttpChooser
java.lang.Object
org.jboss.netty.handler.codec.spdy.SpdyOrHttpChooser
- All Implemented Interfaces:
ChannelHandler
,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.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
private final int
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
SpdyOrHttpChooser
(int maxSpdyContentLength, int maxHttpContentLength) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Add allChannelHandler
's that are needed for HTTP.protected void
addSpdyHandlers
(ChannelHandlerContext ctx, SpdyVersion version) Add allChannelHandler
's that are needed for SPDY with the given version.protected abstract ChannelUpstreamHandler
Create theChannelUpstreamHandler
that is responsible for handling theHttpRequest
's when theSpdyOrHttpChooser.SelectedProtocol
wasSpdyOrHttpChooser.SelectedProtocol.HttpVersion1_0
orSpdyOrHttpChooser.SelectedProtocol.HttpVersion1_1
protected ChannelUpstreamHandler
Create theChannelUpstreamHandler
that is responsible for handling theHttpRequest
's when theSpdyOrHttpChooser.SelectedProtocol
wasSpdyOrHttpChooser.SelectedProtocol.SpdyVersion3_1
.protected abstract SpdyOrHttpChooser.SelectedProtocol
getProtocol
(SSLEngine engine) Return theSpdyOrHttpChooser.SelectedProtocol
for theSSLEngine
.void
Handles the specified upstream event.
-
Field Details
-
maxSpdyContentLength
private final int maxSpdyContentLength -
maxHttpContentLength
private final int maxHttpContentLength
-
-
Constructor Details
-
SpdyOrHttpChooser
protected SpdyOrHttpChooser(int maxSpdyContentLength, int maxHttpContentLength)
-
-
Method Details
-
getProtocol
Return theSpdyOrHttpChooser.SelectedProtocol
for theSSLEngine
. If its not known yet implementations MUST returnSpdyOrHttpChooser.SelectedProtocol.None
. -
handleUpstream
Description copied from interface:ChannelUpstreamHandler
Handles the specified upstream event.- Specified by:
handleUpstream
in interfaceChannelUpstreamHandler
- Parameters:
ctx
- the context object for this handlere
- the upstream event to process or intercept- Throws:
Exception
-
addSpdyHandlers
Add allChannelHandler
's that are needed for SPDY with the given version. -
addHttpHandlers
Add allChannelHandler
's that are needed for HTTP. -
createHttpRequestHandlerForHttp
Create theChannelUpstreamHandler
that is responsible for handling theHttpRequest
's when theSpdyOrHttpChooser.SelectedProtocol
wasSpdyOrHttpChooser.SelectedProtocol.HttpVersion1_0
orSpdyOrHttpChooser.SelectedProtocol.HttpVersion1_1
-
createHttpRequestHandlerForSpdy
Create theChannelUpstreamHandler
that is responsible for handling theHttpRequest
's when theSpdyOrHttpChooser.SelectedProtocol
wasSpdyOrHttpChooser.SelectedProtocol.SpdyVersion3_1
. By default this method will just delecate tocreateHttpRequestHandlerForHttp()
, but sub-classes may override this to change the behaviour.
-