public class HttpServerExpectContinueHandler extends ChannelInboundHandlerAdapter
HttpResponse
发送到包含'expect:100-continue'标头的HttpRequest
。
它只能用于不安装HttpObjectAggregator
的应用程序。
默认情况下,它接受所有期望。
由于HttpServerExpectContinueHandler
预计HttpRequest
s应在HttpServerCodec
之后添加,但在可能发送HttpResponse
的任何其他处理程序之前添加。
ChannelPipeline
p = ...; ... p.addLast("serverCodec", newHttpServerCodec
()); p.addLast("respondExpectContinue", newHttpServerExpectContinueHandler
()); ... p.addLast("handler", new HttpRequestHandler());
ChannelHandler.Sharable
Constructor and Description |
---|
HttpServerExpectContinueHandler() |
Modifier and Type | Method and Description |
---|---|
protected HttpResponse |
acceptMessage(HttpRequest request)
为 HttpRequest 生成一个HttpResponse ,它定义了一个期望值。
|
void |
channelRead(ChannelHandlerContext ctx, java.lang.Object msg)
|
protected HttpResponse |
rejectResponse(HttpRequest request)
返回相应4XX HttpResponse 对于给定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)
protected HttpResponse rejectResponse(HttpRequest request)
HttpResponse
对于给定HttpRequest
。
public void channelRead(ChannelHandlerContext ctx, java.lang.Object msg) throws java.lang.Exception
ChannelInboundHandlerAdapter
ChannelHandlerContext.fireChannelRead(Object)
转发到ChannelPipeline
中的下一个ChannelInboundHandler
。
子类可以重写此方法来更改行为。
channelRead
接口
ChannelInboundHandler
channelRead
在课堂上
ChannelInboundHandlerAdapter
java.lang.Exception
Copyright © 2008–2018 The Netty Project. All rights reserved.