use of com.linkedin.r2.netty.entitystream.StreamReader in project rest.li by linkedin.
the class ClientEntityStreamHandler method write.
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) {
if (msg instanceof StreamRequest) {
StreamRequest request = (StreamRequest) msg;
// Sets reader after the headers have been flushed on the channel
OrderedEntityStreamReader orderedReader = new OrderedEntityStreamReader(ctx, new StreamReader(ctx));
ctx.write(request).addListener(future -> request.getEntityStream().setReader(orderedReader));
} else {
ctx.write(msg);
}
}
Aggregations