public class HttpServerExpectContinueHandler extends ChannelInboundHandlerAdapter
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());
ChannelHandler.Sharable
构造器和说明 |
---|
HttpServerExpectContinueHandler() |
限定符和类型 | 方法和说明 |
---|---|
protected HttpResponse |
acceptMessage(HttpRequest request)
Produces a
HttpResponse for HttpRequest s which define an expectation. |
void |
channelRead(ChannelHandlerContext ctx,
java.lang.Object msg)
Calls
ChannelHandlerContext.fireChannelRead(Object) to forward
to the next ChannelInboundHandler in the ChannelPipeline . |
protected HttpResponse |
rejectResponse(HttpRequest request)
Returns the appropriate 4XX
HttpResponse for the given HttpRequest . |
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handlerAdded, handlerRemoved
protected HttpResponse acceptMessage(HttpRequest request)
HttpResponse
for HttpRequest
s which define an expectation. Returns null
if the
request should be rejected. See rejectResponse(HttpRequest)
.protected HttpResponse rejectResponse(HttpRequest request)
HttpResponse
for the given HttpRequest
.public void channelRead(ChannelHandlerContext ctx, java.lang.Object msg) throws java.lang.Exception
ChannelInboundHandlerAdapter
ChannelHandlerContext.fireChannelRead(Object)
to forward
to the next ChannelInboundHandler
in the ChannelPipeline
.
Sub-classes may override this method to change behavior.channelRead
在接口中 ChannelInboundHandler
channelRead
在类中 ChannelInboundHandlerAdapter
java.lang.Exception