Use supertype HttpObject instead of HttpMessage + HttpChunk where possible
This commit is contained in:
parent
7514a82c35
commit
b923d0c51f
@ -46,7 +46,7 @@ import java.util.Map.Entry;
|
||||
* @apiviz.landmark
|
||||
* @apiviz.has io.netty.handler.codec.http.HttpChunk oneway - - filters out
|
||||
*/
|
||||
public class HttpChunkAggregator extends MessageToMessageDecoder<Object, HttpMessage> {
|
||||
public class HttpChunkAggregator extends MessageToMessageDecoder<HttpObject, HttpMessage> {
|
||||
public static final int DEFAULT_MAX_COMPOSITEBUFFER_COMPONENTS = 1024;
|
||||
private static final ByteBuf CONTINUE = Unpooled.copiedBuffer(
|
||||
"HTTP/1.1 100 Continue\r\n\r\n", CharsetUtil.US_ASCII);
|
||||
@ -66,7 +66,7 @@ public class HttpChunkAggregator extends MessageToMessageDecoder<Object, HttpMes
|
||||
* a {@link TooLongFrameException} will be raised.
|
||||
*/
|
||||
public HttpChunkAggregator(int maxContentLength) {
|
||||
super(HttpMessage.class, HttpChunk.class);
|
||||
super(HttpObject.class);
|
||||
|
||||
if (maxContentLength <= 0) {
|
||||
throw new IllegalArgumentException(
|
||||
@ -109,7 +109,7 @@ public class HttpChunkAggregator extends MessageToMessageDecoder<Object, HttpMes
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpMessage decode(ChannelHandlerContext ctx, Object msg) throws Exception {
|
||||
public HttpMessage decode(ChannelHandlerContext ctx, HttpObject msg) throws Exception {
|
||||
HttpMessage currentMessage = this.currentMessage;
|
||||
|
||||
if (msg instanceof HttpMessage) {
|
||||
|
@ -48,7 +48,7 @@ public abstract class HttpContentDecoder extends MessageToMessageDecoder<Object,
|
||||
* Creates a new instance.
|
||||
*/
|
||||
protected HttpContentDecoder() {
|
||||
super(HttpMessage.class, HttpChunk.class);
|
||||
super(HttpObject.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,7 +57,7 @@ public abstract class HttpContentEncoder extends MessageToMessageCodec<HttpMessa
|
||||
protected HttpContentEncoder() {
|
||||
super(
|
||||
new Class<?>[] { HttpMessage.class },
|
||||
new Class<?>[] { HttpMessage.class, HttpChunk.class });
|
||||
new Class<?>[] { HttpObject.class });
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,7 +50,7 @@ public abstract class HttpMessageEncoder extends MessageToByteEncoder<Object> {
|
||||
* Creates a new instance.
|
||||
*/
|
||||
protected HttpMessageEncoder() {
|
||||
super(HttpMessage.class, HttpChunk.class);
|
||||
super(HttpObject.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -22,6 +22,7 @@ import io.netty.handler.codec.http.HttpChunk;
|
||||
import io.netty.handler.codec.http.HttpChunkTrailer;
|
||||
import io.netty.handler.codec.http.HttpHeaders;
|
||||
import io.netty.handler.codec.http.HttpMessage;
|
||||
import io.netty.handler.codec.http.HttpObject;
|
||||
import io.netty.handler.codec.http.HttpRequest;
|
||||
import io.netty.handler.codec.http.HttpResponse;
|
||||
|
||||
@ -129,7 +130,7 @@ public class SpdyHttpEncoder extends MessageToMessageEncoder<Object, Object> {
|
||||
* @param version the protocol version
|
||||
*/
|
||||
public SpdyHttpEncoder(int version) {
|
||||
super(HttpMessage.class, HttpChunk.class);
|
||||
super(HttpObject.class);
|
||||
|
||||
if (version < SpdyConstants.SPDY_MIN_VERSION || version > SpdyConstants.SPDY_MAX_VERSION) {
|
||||
throw new IllegalArgumentException(
|
||||
|
Loading…
Reference in New Issue
Block a user