Package io.netty.handler.codec.http
Class HttpServerCodec
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.channel.ChannelDuplexHandler
-
- io.netty.channel.CombinedChannelDuplexHandler<HttpRequestDecoder,HttpResponseEncoder>
-
- io.netty.handler.codec.http.HttpServerCodec
-
- All Implemented Interfaces:
ChannelHandler
,ChannelInboundHandler
,ChannelOutboundHandler
,HttpServerUpgradeHandler.SourceCodec
public final class HttpServerCodec extends CombinedChannelDuplexHandler<HttpRequestDecoder,HttpResponseEncoder> implements HttpServerUpgradeHandler.SourceCodec
A combination ofHttpRequestDecoder
andHttpResponseEncoder
which enables easier server side HTTP implementation.- See Also:
HttpClientCodec
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
HttpServerCodec.HttpServerRequestDecoder
private class
HttpServerCodec.HttpServerResponseEncoder
-
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Queue<HttpMethod>
queue
A queue that is used for correlating a request and a response.
-
Constructor Summary
Constructors Constructor Description HttpServerCodec()
Creates a new instance with the default decoder options (maxInitialLineLength (4096)
,maxHeaderSize (8192)
, andmaxChunkSize (8192)
).HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize)
Creates a new instance with the specified decoder options.HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders)
Creates a new instance with the specified decoder options.HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders, int initialBufferSize)
Creates a new instance with the specified decoder options.HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders, int initialBufferSize, boolean allowDuplicateContentLengths)
Creates a new instance with the specified decoder options.HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders, int initialBufferSize, boolean allowDuplicateContentLengths, boolean allowPartialChunks)
Creates a new instance with the specified decoder options.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
upgradeFrom(ChannelHandlerContext ctx)
Upgrades to another protocol from HTTP.-
Methods inherited from class io.netty.channel.CombinedChannelDuplexHandler
bind, channelActive, channelInactive, channelRead, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, close, connect, deregister, disconnect, exceptionCaught, flush, handlerAdded, handlerRemoved, inboundHandler, init, outboundHandler, read, removeInboundHandler, removeOutboundHandler, userEventTriggered, write
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, isSharable
-
-
-
-
Field Detail
-
queue
private final java.util.Queue<HttpMethod> queue
A queue that is used for correlating a request and a response.
-
-
Constructor Detail
-
HttpServerCodec
public HttpServerCodec()
Creates a new instance with the default decoder options (maxInitialLineLength (4096)
,maxHeaderSize (8192)
, andmaxChunkSize (8192)
).
-
HttpServerCodec
public HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize)
Creates a new instance with the specified decoder options.
-
HttpServerCodec
public HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders)
Creates a new instance with the specified decoder options.
-
HttpServerCodec
public HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders, int initialBufferSize)
Creates a new instance with the specified decoder options.
-
HttpServerCodec
public HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders, int initialBufferSize, boolean allowDuplicateContentLengths)
Creates a new instance with the specified decoder options.
-
HttpServerCodec
public HttpServerCodec(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean validateHeaders, int initialBufferSize, boolean allowDuplicateContentLengths, boolean allowPartialChunks)
Creates a new instance with the specified decoder options.
-
-
Method Detail
-
upgradeFrom
public void upgradeFrom(ChannelHandlerContext ctx)
Upgrades to another protocol from HTTP. Removes theHttpRequestDecoder
andHttpResponseEncoder
from the pipeline.- Specified by:
upgradeFrom
in interfaceHttpServerUpgradeHandler.SourceCodec
-
-