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
public class HttpServerExpectContinueHandler extends ChannelInboundHandlerAdapter
Sends a 100 CONTINUEHttpResponsetoHttpRequests which contain a 'expect: 100-continue' header. It should only be used for applications which do not install theHttpObjectAggregator.By default it accepts all expectations.
Since
HttpServerExpectContinueHandlerexpectsHttpRequests it should be added afterHttpServerCodecbut before any other handlers that might send aHttpResponse.ChannelPipelinep = ...; ... 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
-
-
Constructor Summary
Constructors Constructor Description HttpServerExpectContinueHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected HttpResponseacceptMessage(HttpRequest request)Produces aHttpResponseforHttpRequests which define an expectation.voidchannelRead(ChannelHandlerContext ctx, java.lang.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 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
-
-
-
-
Method Detail
-
acceptMessage
protected HttpResponse acceptMessage(HttpRequest request)
Produces aHttpResponseforHttpRequests which define an expectation. Returnsnullif the request should be rejected. SeerejectResponse(HttpRequest).
-
rejectResponse
protected HttpResponse rejectResponse(HttpRequest request)
Returns the appropriate 4XXHttpResponsefor the givenHttpRequest.
-
channelRead
public void channelRead(ChannelHandlerContext ctx, java.lang.Object msg) throws java.lang.Exception
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:
java.lang.Exception
-
-