Sergey Mashkov
Sergey Mashkov

Reputation: 4780

How to write HttpChunkedInput / ChunkedStream?

I have the following code that works perfect:

sendHeaders(obj)
setChunked()
sendRequestMessage()

context.write(DefaultFileRegion(obj.file, 0L, obj.file.length()))
context.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT)

But if I send

context.writeAndFlush(HttpChunkedInput(ChunkedStream(obj.stream().buffered())))

then I get UnsupportedOperationExcpetion because HttpChunkedInput is not suported. But there are many examples (at least HttpStaticFileServerHandler) so they do the same and it works. Why?

Upvotes: 0

Views: 222

Answers (1)

Sergey Mashkov
Sergey Mashkov

Reputation: 4780

I just forgot to add ChunkedWriteHandler to the pipeline

addLast("streamer", ChunkedWriteHandler())

Upvotes: 1

Related Questions