#9867 fix confusing method parameter name (#9874)

Motivation:

Parameter name is confusing and not match the actual type.

Modification:

Rename parameter.

Result:

Code cleanup
This commit is contained in:
Dmitriy Dumanskiy 2019-12-12 15:41:41 +02:00 committed by Norman Maurer
parent a7c18d44b4
commit 0992718f87
3 changed files with 9 additions and 9 deletions

View File

@ -132,15 +132,15 @@ public class HttpContentCompressor extends HttpContentEncoder {
} }
@Override @Override
protected Result beginEncode(HttpResponse headers, String acceptEncoding) throws Exception { protected Result beginEncode(HttpResponse httpResponse, String acceptEncoding) throws Exception {
if (this.contentSizeThreshold > 0) { if (this.contentSizeThreshold > 0) {
if (headers instanceof HttpContent && if (httpResponse instanceof HttpContent &&
((HttpContent) headers).content().readableBytes() < contentSizeThreshold) { ((HttpContent) httpResponse).content().readableBytes() < contentSizeThreshold) {
return null; return null;
} }
} }
String contentEncoding = headers.headers().get(HttpHeaderNames.CONTENT_ENCODING); String contentEncoding = httpResponse.headers().get(HttpHeaderNames.CONTENT_ENCODING);
if (contentEncoding != null) { if (contentEncoding != null) {
// Content-Encoding was set, either as something specific or as the IDENTITY encoding // Content-Encoding was set, either as something specific or as the IDENTITY encoding
// Therefore, we should NOT encode here // Therefore, we should NOT encode here

View File

@ -288,8 +288,8 @@ public abstract class HttpContentEncoder extends MessageToMessageCodec<HttpReque
/** /**
* Prepare to encode the HTTP message content. * Prepare to encode the HTTP message content.
* *
* @param headers * @param httpResponse
* the headers * the http response
* @param acceptEncoding * @param acceptEncoding
* the value of the {@code "Accept-Encoding"} header * the value of the {@code "Accept-Encoding"} header
* *
@ -299,7 +299,7 @@ public abstract class HttpContentEncoder extends MessageToMessageCodec<HttpReque
* {@code null} if {@code acceptEncoding} is unsupported or rejected * {@code null} if {@code acceptEncoding} is unsupported or rejected
* and thus the content should be handled as-is (i.e. no encoding). * and thus the content should be handled as-is (i.e. no encoding).
*/ */
protected abstract Result beginEncode(HttpResponse headers, String acceptEncoding) throws Exception; protected abstract Result beginEncode(HttpResponse httpResponse, String acceptEncoding) throws Exception;
@Override @Override
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception { public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {

View File

@ -41,7 +41,7 @@ public class HttpContentEncoderTest {
private static final class TestEncoder extends HttpContentEncoder { private static final class TestEncoder extends HttpContentEncoder {
@Override @Override
protected Result beginEncode(HttpResponse headers, String acceptEncoding) { protected Result beginEncode(HttpResponse httpResponse, String acceptEncoding) {
return new Result("test", new EmbeddedChannel(new MessageToByteEncoder<ByteBuf>() { return new Result("test", new EmbeddedChannel(new MessageToByteEncoder<ByteBuf>() {
@Override @Override
protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception { protected void encode(ChannelHandlerContext ctx, ByteBuf in, ByteBuf out) throws Exception {
@ -395,7 +395,7 @@ public class HttpContentEncoderTest {
public void testCleanupThrows() { public void testCleanupThrows() {
HttpContentEncoder encoder = new HttpContentEncoder() { HttpContentEncoder encoder = new HttpContentEncoder() {
@Override @Override
protected Result beginEncode(HttpResponse headers, String acceptEncoding) throws Exception { protected Result beginEncode(HttpResponse httpResponse, String acceptEncoding) throws Exception {
return new Result("myencoding", new EmbeddedChannel( return new Result("myencoding", new EmbeddedChannel(
new ChannelInboundHandlerAdapter() { new ChannelInboundHandlerAdapter() {
@Override @Override