Code clean up
This commit is contained in:
parent
46e9fe364a
commit
58086a865f
@ -91,10 +91,9 @@ public abstract class HttpMessageEncoder extends OneToOneEncoder {
|
|||||||
if (msg instanceof HttpChunk) {
|
if (msg instanceof HttpChunk) {
|
||||||
HttpChunk chunk = (HttpChunk) msg;
|
HttpChunk chunk = (HttpChunk) msg;
|
||||||
if (chunked) {
|
if (chunked) {
|
||||||
if (chunk == HttpChunk.LAST_CHUNK) {
|
if (chunk.isLast()) {
|
||||||
chunked = false;
|
chunked = false;
|
||||||
return LAST_CHUNK.duplicate();
|
if (chunk instanceof HttpChunkTrailer) {
|
||||||
} else if (chunk instanceof HttpChunkTrailer) {
|
|
||||||
ChannelBuffer trailer = ChannelBuffers.dynamicBuffer(
|
ChannelBuffer trailer = ChannelBuffers.dynamicBuffer(
|
||||||
channel.getConfig().getBufferFactory());
|
channel.getConfig().getBufferFactory());
|
||||||
trailer.writeByte((byte) '0');
|
trailer.writeByte((byte) '0');
|
||||||
@ -102,6 +101,9 @@ public abstract class HttpMessageEncoder extends OneToOneEncoder {
|
|||||||
encodeTrailingHeaders(trailer, (HttpChunkTrailer) chunk);
|
encodeTrailingHeaders(trailer, (HttpChunkTrailer) chunk);
|
||||||
trailer.writeBytes(CRLF);
|
trailer.writeBytes(CRLF);
|
||||||
return trailer;
|
return trailer;
|
||||||
|
} else {
|
||||||
|
return LAST_CHUNK.duplicate();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ChannelBuffer content = chunk.getContent();
|
ChannelBuffer content = chunk.getContent();
|
||||||
int contentLength = content.readableBytes();
|
int contentLength = content.readableBytes();
|
||||||
@ -115,7 +117,7 @@ public abstract class HttpMessageEncoder extends OneToOneEncoder {
|
|||||||
wrappedBuffer(CRLF));
|
wrappedBuffer(CRLF));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (chunk == HttpChunk.LAST_CHUNK) {
|
if (chunk.isLast()) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return chunk.getContent();
|
return chunk.getContent();
|
||||||
|
Loading…
Reference in New Issue
Block a user