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 HttpRequests 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 HttpRequests it should be added after HttpServerCodec but before any other handlers that might send a HttpResponse.
ChannelPipelinep = ...; ... p.addLast("serverCodec", newHttpServerCodec()); p.addLast("respondExpectContinue", newHttpServerExpectContinueHandler()); ... p.addLast("handler", new HttpRequestHandler());
-
Nested Class Summary
Nested classes/interfaces inherited from interface ChannelHandler
ChannelHandler.Sharable -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected HttpResponseacceptMessage(HttpRequest request) Produces aHttpResponseforHttpRequests which define an expectation.voidchannelRead(ChannelHandlerContext ctx, Object msg) CallsChannelHandlerContext.fireChannelRead(Object)to forward to the nextChannelInboundHandlerin theChannelPipeline.protected HttpResponserejectResponse(HttpRequest request) Returns the appropriate 4XXHttpResponsefor the givenHttpRequest.Methods inherited from class ChannelInboundHandlerAdapter
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredMethods inherited from class ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharableMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ChannelHandler
handlerAdded, handlerRemoved
-
Constructor Details
-
HttpServerExpectContinueHandler
public HttpServerExpectContinueHandler()
-
-
Method Details
-
acceptMessage
Produces aHttpResponseforHttpRequests which define an expectation. Returnsnullif the request should be rejected. SeerejectResponse(HttpRequest). -
rejectResponse
Returns the appropriate 4XXHttpResponsefor the givenHttpRequest. -
channelRead
Description copied from class:ChannelInboundHandlerAdapterCallsChannelHandlerContext.fireChannelRead(Object)to forward to the nextChannelInboundHandlerin theChannelPipeline. Sub-classes may override this method to change behavior.- Specified by:
channelReadin interfaceChannelInboundHandler- Overrides:
channelReadin classChannelInboundHandlerAdapter- Throws:
Exception
-