Package io.netty.handler.codec.http
Class HttpServerExpectContinueHandler
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.handler.codec.http.HttpServerExpectContinueHandler
- All Implemented Interfaces:
ChannelHandler
,ChannelInboundHandler
Sends a 100 CONTINUE
HttpResponse
to HttpRequest
s which contain a 'expect: 100-continue' header. It
should only be used for applications which do not install the HttpObjectAggregator
.
By default it accepts all expectations.
Since HttpServerExpectContinueHandler
expects HttpRequest
s it should be added after HttpServerCodec
but before any other handlers that might send a HttpResponse
.
ChannelPipeline
p = ...; ... p.addLast("serverCodec", newHttpServerCodec
()); p.addLast("respondExpectContinue", newHttpServerExpectContinueHandler
()); ... p.addLast("handler", new HttpRequestHandler());
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final FullHttpResponse
private static final FullHttpResponse
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected HttpResponse
acceptMessage
(HttpRequest request) Produces aHttpResponse
forHttpRequest
s which define an expectation.void
channelRead
(ChannelHandlerContext ctx, Object msg) CallsChannelHandlerContext.fireChannelRead(Object)
to forward to the nextChannelInboundHandler
in theChannelPipeline
.protected HttpResponse
rejectResponse
(HttpRequest request) Returns the appropriate 4XXHttpResponse
for the givenHttpRequest
.Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
Field Details
-
EXPECTATION_FAILED
-
ACCEPT
-
-
Constructor Details
-
HttpServerExpectContinueHandler
public HttpServerExpectContinueHandler()
-
-
Method Details
-
acceptMessage
Produces aHttpResponse
forHttpRequest
s which define an expectation. Returnsnull
if the request should be rejected. SeerejectResponse(HttpRequest)
. -
rejectResponse
Returns the appropriate 4XXHttpResponse
for the givenHttpRequest
. -
channelRead
Description copied from class:ChannelInboundHandlerAdapter
CallsChannelHandlerContext.fireChannelRead(Object)
to forward to the nextChannelInboundHandler
in theChannelPipeline
. Sub-classes may override this method to change behavior.- Specified by:
channelRead
in interfaceChannelInboundHandler
- Overrides:
channelRead
in classChannelInboundHandlerAdapter
- Throws:
Exception
-