#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 4a8476af67
commit 0611683106
3 changed files with 9 additions and 9 deletions

View File

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

View File

@ -289,8 +289,8 @@ public abstract class HttpContentEncoder extends MessageToMessageCodec<HttpReque
/**
* Prepare to encode the HTTP message content.
*
* @param headers
* the headers
* @param httpResponse
* the http response
* @param acceptEncoding
* the value of the {@code "Accept-Encoding"} header
*
@ -300,7 +300,7 @@ public abstract class HttpContentEncoder extends MessageToMessageCodec<HttpReque
* {@code null} if {@code acceptEncoding} is unsupported or rejected
* 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
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {

View File

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