Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,7 @@ protected void channelRead0(ChannelHandlerContext ctx, Object msg)
ctx.channel().attr(ClientRequestResponseConverter.DISCARD_CONNECTION).set(true); // SSE traffic should always discard connection on close.

ChannelPipeline pipeline = ctx.channel().pipeline();
if (!HttpHeaders.isTransferEncodingChunked((HttpResponse) msg)) {
pipeline.addFirst(SSE_DECODER_HANDLER_NAME, new ServerSentEventDecoder());
/*
* If there are buffered messages in the previous handler at the time this message is read, we would
* not be able to convert the content into an SseEvent. For this reason, we also add the decoder after
* this handler, so that we can handle the buffered messages.
* See the class level javadoc for more details.
*/
pipeline.addAfter(NAME, SSE_DECODER_POST_INBOUND_HANDLER, new ServerSentEventDecoder());
} else {
pipeline.addAfter(NAME, SSE_DECODER_HANDLER_NAME, new ServerSentEventDecoder());
}
pipeline.addAfter(NAME, SSE_DECODER_HANDLER_NAME, new ServerSentEventDecoder());
ctx.fireChannelRead(msg);
} else if (msg instanceof LastHttpContent) {
LastHttpContent lastHttpContent = (LastHttpContent) msg;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,7 @@ protected void channelRead0(ChannelHandlerContext ctx, Object msg)
ctx.channel().attr(ClientRequestResponseConverter.DISCARD_CONNECTION).set(true); // SSE traffic should always discard connection on close.

ChannelPipeline pipeline = ctx.channel().pipeline();
if (!HttpHeaders.isTransferEncodingChunked((HttpResponse) msg)) {
pipeline.addFirst(SSE_DECODER_HANDLER_NAME, new ServerSentEventDecoder());
/*
* If there are buffered messages in the previous handler at the time this message is read, we would
* not be able to convert the content into an SseEvent. For this reason, we also add the decoder after
* this handler, so that we can handle the buffered messages.
* See the class level javadoc for more details.
*/
pipeline.addAfter(NAME, SSE_DECODER_POST_INBOUND_HANDLER, new ServerSentEventDecoder());
} else {
pipeline.addAfter(NAME, SSE_DECODER_HANDLER_NAME, new ServerSentEventDecoder());
}
pipeline.addAfter(NAME, SSE_DECODER_HANDLER_NAME, new ServerSentEventDecoder());
ctx.fireChannelRead(msg);
} else if (msg instanceof LastHttpContent) {
LastHttpContent lastHttpContent = (LastHttpContent) msg;
Expand Down