Added default constructors with sensible default values

This commit is contained in:
Trustin Lee 2009-03-10 08:57:02 +00:00
parent 4e989e20d4
commit e523b8ec0f
5 changed files with 18 additions and 3 deletions

View File

@ -43,7 +43,7 @@ public class HttpClientPipelineFactory implements ChannelPipelineFactory {
public ChannelPipeline getPipeline() throws Exception { public ChannelPipeline getPipeline() throws Exception {
// Create a default pipeline implementation. // Create a default pipeline implementation.
ChannelPipeline pipeline = pipeline(); ChannelPipeline pipeline = pipeline();
pipeline.addLast("decoder", new HttpResponseDecoder(8192, 8192, 8192)); pipeline.addLast("decoder", new HttpResponseDecoder());
//pipeline.addLast("aggregator", new HttpChunkAggregator(1048576)); //pipeline.addLast("aggregator", new HttpChunkAggregator(1048576));
pipeline.addLast("encoder", new HttpRequestEncoder()); pipeline.addLast("encoder", new HttpRequestEncoder());
pipeline.addLast("handler", handler); pipeline.addLast("handler", handler);

View File

@ -44,7 +44,7 @@ public class HttpServerPipelineFactory implements ChannelPipelineFactory {
// Create a default pipeline implementation. // Create a default pipeline implementation.
ChannelPipeline pipeline = pipeline(); ChannelPipeline pipeline = pipeline();
pipeline.addLast("decoder", new HttpRequestDecoder(8192, 8192, 8192)); pipeline.addLast("decoder", new HttpRequestDecoder());
//pipeline.addLast("aggregator", new HttpChunkAggregator(1048576)); //pipeline.addLast("aggregator", new HttpChunkAggregator(1048576));
pipeline.addLast("encoder", new HttpResponseEncoder()); pipeline.addLast("encoder", new HttpResponseEncoder());
pipeline.addLast("handler", handler); pipeline.addLast("handler", handler);

View File

@ -77,8 +77,15 @@ public abstract class HttpMessageDecoder extends ReplayingDecoder<HttpMessageDec
READ_CHUNK_FOOTER; READ_CHUNK_FOOTER;
} }
protected HttpMessageDecoder(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize) { protected HttpMessageDecoder() {
this(4096, 8192, 8192);
}
protected HttpMessageDecoder(
int maxInitialLineLength, int maxHeaderSize, int maxChunkSize) {
super(State.SKIP_CONTROL_CHARS, true); super(State.SKIP_CONTROL_CHARS, true);
if (maxInitialLineLength <= 0) { if (maxInitialLineLength <= 0) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"maxInitialLineLength must be a positive integer: " + "maxInitialLineLength must be a positive integer: " +

View File

@ -32,6 +32,10 @@ package org.jboss.netty.handler.codec.http;
*/ */
public class HttpRequestDecoder extends HttpMessageDecoder { public class HttpRequestDecoder extends HttpMessageDecoder {
public HttpRequestDecoder() {
super();
}
public HttpRequestDecoder( public HttpRequestDecoder(
int maxInitialLineLength, int maxHeaderSize, int maxChunkSize) { int maxInitialLineLength, int maxHeaderSize, int maxChunkSize) {
super(maxInitialLineLength, maxHeaderSize, maxChunkSize); super(maxInitialLineLength, maxHeaderSize, maxChunkSize);

View File

@ -32,6 +32,10 @@ package org.jboss.netty.handler.codec.http;
*/ */
public class HttpResponseDecoder extends HttpMessageDecoder { public class HttpResponseDecoder extends HttpMessageDecoder {
public HttpResponseDecoder() {
super();
}
public HttpResponseDecoder( public HttpResponseDecoder(
int maxInitialLineLength, int maxHeaderSize, int maxChunkSize) { int maxInitialLineLength, int maxHeaderSize, int maxChunkSize) {
super(maxInitialLineLength, maxHeaderSize, maxChunkSize); super(maxInitialLineLength, maxHeaderSize, maxChunkSize);