cleanup, duplicated static final fields
Motivation: There are few duplicated byte[] CRLF fields in code. Modifications: Removed duplicated fields as they could be inherited from parent encoder. Result: Less static fields.
This commit is contained in:
parent
65dea8aeec
commit
1bcc070943
@ -47,7 +47,7 @@ import static io.netty.handler.codec.http.HttpConstants.LF;
|
|||||||
* implement all abstract methods properly.
|
* implement all abstract methods properly.
|
||||||
*/
|
*/
|
||||||
public abstract class HttpObjectEncoder<H extends HttpMessage> extends MessageToMessageEncoder<Object> {
|
public abstract class HttpObjectEncoder<H extends HttpMessage> extends MessageToMessageEncoder<Object> {
|
||||||
private static final byte[] CRLF = { CR, LF };
|
static final byte[] CRLF = { CR, LF };
|
||||||
private static final byte[] ZERO_CRLF = { '0', CR, LF };
|
private static final byte[] ZERO_CRLF = { '0', CR, LF };
|
||||||
private static final byte[] ZERO_CRLF_CRLF = { '0', CR, LF, CR, LF };
|
private static final byte[] ZERO_CRLF_CRLF = { '0', CR, LF, CR, LF };
|
||||||
private static final ByteBuf CRLF_BUF = unreleasableBuffer(directBuffer(CRLF.length).writeBytes(CRLF));
|
private static final ByteBuf CRLF_BUF = unreleasableBuffer(directBuffer(CRLF.length).writeBytes(CRLF));
|
||||||
|
@ -31,7 +31,6 @@ import static io.netty.handler.codec.http.HttpConstants.SP;
|
|||||||
public class HttpRequestEncoder extends HttpObjectEncoder<HttpRequest> {
|
public class HttpRequestEncoder extends HttpObjectEncoder<HttpRequest> {
|
||||||
private static final char SLASH = '/';
|
private static final char SLASH = '/';
|
||||||
private static final char QUESTION_MARK = '?';
|
private static final char QUESTION_MARK = '?';
|
||||||
private static final byte[] CRLF = { CR, LF };
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean acceptOutboundMessage(Object msg) throws Exception {
|
public boolean acceptOutboundMessage(Object msg) throws Exception {
|
||||||
|
@ -24,7 +24,6 @@ import static io.netty.handler.codec.http.HttpConstants.*;
|
|||||||
* a {@link ByteBuf}.
|
* a {@link ByteBuf}.
|
||||||
*/
|
*/
|
||||||
public class HttpResponseEncoder extends HttpObjectEncoder<HttpResponse> {
|
public class HttpResponseEncoder extends HttpObjectEncoder<HttpResponse> {
|
||||||
private static final byte[] CRLF = { CR, LF };
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean acceptOutboundMessage(Object msg) throws Exception {
|
public boolean acceptOutboundMessage(Object msg) throws Exception {
|
||||||
|
Loading…
Reference in New Issue
Block a user