HttpObjectEncoder#isContentAlwaysEmpty cannot be overridden by subclasses

Motivation:

Allow subclasses of HttpObjectEncoder other than HttpServerCodec to override the isContentAlwaysEmpty method

Modification:

Change the method visibility from package private to protected

Result:

Fixes #6761
This commit is contained in:
Julien Viet 2017-05-29 14:40:35 +02:00 committed by Norman Maurer
parent 1504abd474
commit eee0ec3902
2 changed files with 9 additions and 2 deletions

View File

@ -195,7 +195,14 @@ public abstract class HttpObjectEncoder<H extends HttpMessage> extends MessageTo
} }
} }
boolean isContentAlwaysEmpty(@SuppressWarnings("unused") H msg) { /**
* Determine whether a message has a content or not. Some message may have headers indicating
* a content without having an actual content, e.g the response to an HEAD or CONNECT request.
*
* @param msg the message to test
* @return {@code true} to signal the message has no content
*/
protected boolean isContentAlwaysEmpty(@SuppressWarnings("unused") H msg) {
return false; return false;
} }

View File

@ -112,7 +112,7 @@ public final class HttpServerCodec extends CombinedChannelDuplexHandler<HttpRequ
private final class HttpServerResponseEncoder extends HttpResponseEncoder { private final class HttpServerResponseEncoder extends HttpResponseEncoder {
@Override @Override
boolean isContentAlwaysEmpty(@SuppressWarnings("unused") HttpResponse msg) { protected boolean isContentAlwaysEmpty(@SuppressWarnings("unused") HttpResponse msg) {
return HttpMethod.HEAD.equals(queue.poll()); return HttpMethod.HEAD.equals(queue.poll());
} }
} }