HTTPRequestEncoder
A ChannelOutboundHandler
that can serialize HTTP requests.
final class HTTPRequestEncoder
This channel handler is used to translate messages from a series of HTTPClientRequestPart
into the HTTP/1.1 wire format.
A ChannelOutboundHandler
that can serialize HTTP requests.
final class HTTPRequestEncoder
This channel handler is used to translate messages from a series of HTTPClientRequestPart
into the HTTP/1.1 wire format.
import NIOHTTP1
protocol ChannelHandler : AnyObject
Base protocol for handlers that handle I/O events or intercept an I/O operation.
protocol ChannelOutboundHandler : _ChannelOutboundHandler, _EmittingChannelHandler
ChannelHandler
which handles outbound I/O events or intercept an outbound I/O operation for a Channel
.
protocol RemovableChannelHandler : ChannelHandler
A RemovableChannelHandler
is a ChannelHandler
that can be dynamically removed from a ChannelPipeline
whilst the Channel
is operating normally. A RemovableChannelHandler
is required to remove itself from the ChannelPipeline
(using ChannelHandlerContext.leavePipeline
) as soon as possible.
protocol _ChannelOutboundHandler : ChannelHandler
Untyped ChannelHandler
which handles outbound I/O events or intercept an outbound I/O operation.
protocol _EmittingChannelHandler
ChannelHandler which will emit data by calling ChannelHandlerContext.write
.
convenience init()
init(configuration: HTTPRequestEncoder.Configuration)
func write(context: ChannelHandlerContext, data: NIOAny, promise: EventLoopPromise<Void>?)
struct Configuration
Configuration for the HTTPRequestEncoder
.
typealias OutboundIn = HTTPClientRequestPart
typealias OutboundOut = IOData
func bind(context: ChannelHandlerContext, to address: SocketAddress, promise: EventLoopPromise<Void>?)
func close(context: ChannelHandlerContext, mode: CloseMode, promise: EventLoopPromise<Void>?)
func connect(context: ChannelHandlerContext, to address: SocketAddress, promise: EventLoopPromise<Void>?)
func flush(context: ChannelHandlerContext)
func handlerAdded(context: ChannelHandlerContext)
Do nothing by default.
func handlerRemoved(context: ChannelHandlerContext)
Do nothing by default.
func read(context: ChannelHandlerContext)
func register(context: ChannelHandlerContext, promise: EventLoopPromise<Void>?)
func removeHandler(context: ChannelHandlerContext, removalToken: ChannelHandlerContext.RemovalToken)
Implements the default behaviour which is to synchronously remove the handler from the pipeline. Thanks to this, stateless ChannelHandler
s can just use RemovableChannelHandler
as a marker-protocol and declare themselves as removable without writing any extra code.
func triggerUserOutboundEvent(context: ChannelHandlerContext, event: Any, promise: EventLoopPromise<Void>?)
func unwrapOutboundIn(_ value: NIOAny) -> Self.OutboundIn
func wrapOutboundOut(_ value: Self.OutboundOut) -> NIOAny