public class ChunkedResponseWriteHandler
extends io.netty.channel.ChannelDuplexHandler
ChannelHandler that adds support for writing chunked xrootd replies.
Loosely based on io.netty.handler.stream.ChunkedWriteHandler, but specialized for xrootd.
Xrootd allows replies to be delivered out of order, which means that unchunked responses do not
have to be queued and can be passed downstream right away.
Since the handler is protocol specific, it can generated proper xrootd error responses in case
of faults.
ChunkedResponseWriteHandler does not support suspended transfers.
To use ChunkedResponseWriteHandler, you have to insert
a new ChunkedResponseWriteHandler instance:
Once inserted, you can write aChannelPipelinep = ...; p.addLast("streamer", newChunkedResponseWriteHandler()); p.addLast("handler", new MyHandler());
ChunkedResponse so that the
ChunkedResponseWriteHandler can pick it up and fetch the content of the
stream chunk by chunk and write the fetched chunk downstream:
Channelch = ...;ReadRequestrequest = ...; long maxFrameSize = 2 << 20;FileChannelchannel = ...; ch.write(newChunkedFileChannelReadResponse(request, maxFrameSize, channel));
| Constructor and Description |
|---|
ChunkedResponseWriteHandler() |
| Modifier and Type | Method and Description |
|---|---|
void |
channelInactive(io.netty.channel.ChannelHandlerContext ctx) |
void |
channelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx) |
void |
flush(io.netty.channel.ChannelHandlerContext ctx) |
void |
write(io.netty.channel.ChannelHandlerContext ctx,
Object msg,
io.netty.channel.ChannelPromise promise) |
bind, close, connect, deregister, disconnect, readchannelActive, channelRead, channelReadComplete, channelRegistered, channelUnregistered, exceptionCaught, userEventTriggeredhandlerAdded, handlerRemoved, isSharablepublic void write(io.netty.channel.ChannelHandlerContext ctx,
Object msg,
io.netty.channel.ChannelPromise promise)
throws Exception
write in interface io.netty.channel.ChannelOutboundHandlerwrite in class io.netty.channel.ChannelDuplexHandlerExceptionpublic void flush(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
flush in interface io.netty.channel.ChannelOutboundHandlerflush in class io.netty.channel.ChannelDuplexHandlerExceptionpublic void channelInactive(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
channelInactive in interface io.netty.channel.ChannelInboundHandlerchannelInactive in class io.netty.channel.ChannelInboundHandlerAdapterExceptionpublic void channelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx)
throws Exception
channelWritabilityChanged in interface io.netty.channel.ChannelInboundHandlerchannelWritabilityChanged in class io.netty.channel.ChannelInboundHandlerAdapterExceptionCopyright © 2011–2018 dCache.org. All rights reserved.