Module io.netty5.codec.http
Package io.netty5.handler.codec.http
Class HttpServerExpectContinueHandler
- java.lang.Object
-
- io.netty5.handler.codec.http.HttpServerExpectContinueHandler
-
- All Implemented Interfaces:
ChannelHandler
public class HttpServerExpectContinueHandler extends Object implements ChannelHandler
Sends a 100 CONTINUEHttpResponse
toHttpRequest
s 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
HttpServerExpectContinueHandler
expectsHttpRequest
s it should be added afterHttpServerCodec
but before any other handlers that might send aHttpResponse
.ChannelPipeline
p = ...; ... p.addLast("serverCodec", newHttpServerCodec
()); p.addLast("respondExpectContinue", newHttpServerExpectContinueHandler
()); ... p.addLast("handler", new HttpRequestHandler());
-
-
Constructor Summary
Constructors Constructor Description HttpServerExpectContinueHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected HttpResponse
acceptMessage(BufferAllocator allocator, HttpRequest request)
Produces aHttpResponse
forHttpRequest
s which define an expectation.void
channelRead(ChannelHandlerContext ctx, Object msg)
Invoked when the currentChannel
has read a message from the peer.protected HttpResponse
rejectResponse(BufferAllocator allocator, HttpRequest request)
Returns the appropriate 4XXHttpResponse
for the givenHttpRequest
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty5.channel.ChannelHandler
bind, channelActive, channelExceptionCaught, channelInactive, channelInboundEvent, channelReadComplete, channelRegistered, channelShutdown, channelUnregistered, channelWritabilityChanged, close, connect, deregister, disconnect, flush, handlerAdded, handlerRemoved, isSharable, pendingOutboundBytes, read, register, sendOutboundEvent, shutdown, write
-
-
-
-
Method Detail
-
acceptMessage
protected HttpResponse acceptMessage(BufferAllocator allocator, HttpRequest request)
Produces aHttpResponse
forHttpRequest
s which define an expectation. Returnsnull
if the request should be rejected. SeerejectResponse(BufferAllocator, HttpRequest)
.
-
rejectResponse
protected HttpResponse rejectResponse(BufferAllocator allocator, HttpRequest request)
Returns the appropriate 4XXHttpResponse
for the givenHttpRequest
.
-
channelRead
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
Description copied from interface:ChannelHandler
Invoked when the currentChannel
has read a message from the peer.- Specified by:
channelRead
in interfaceChannelHandler
- Throws:
Exception
-
-