Rename HTTP upload example classes for disambiguation

This commit is contained in:
Trustin Lee 2012-01-15 00:31:02 +09:00
parent b7cfc6b7f0
commit 4cff6b56ff
6 changed files with 12 additions and 12 deletions

View File

@ -44,12 +44,12 @@ import io.netty.handler.codec.http.HttpPostRequestEncoder.ErrorDataEncoderExcept
/** /**
*/ */
public class HttpClient { public class HttpUploadClient {
public static void main(String[] args) { public static void main(String[] args) {
if (args.length != 2) { if (args.length != 2) {
System.err.println( System.err.println(
"Usage: " + HttpClient.class.getSimpleName() + "Usage: " + HttpUploadClient.class.getSimpleName() +
" baseURI Filepath"); " baseURI Filepath");
return; return;
} }
@ -110,7 +110,7 @@ public class HttpClient {
Executors.newCachedThreadPool())); Executors.newCachedThreadPool()));
// Set up the event pipeline factory. // Set up the event pipeline factory.
bootstrap.setPipelineFactory(new HttpClientPipelineFactory(ssl)); bootstrap.setPipelineFactory(new HttpUploadClientPipelineFactory(ssl));
// setup the factory: here using a mixed memory/disk based on size threshold // setup the factory: here using a mixed memory/disk based on size threshold
HttpDataFactory factory = new DefaultHttpDataFactory( HttpDataFactory factory = new DefaultHttpDataFactory(

View File

@ -24,7 +24,7 @@ import io.netty.handler.codec.http.HttpChunk;
import io.netty.handler.codec.http.HttpResponse; import io.netty.handler.codec.http.HttpResponse;
import io.netty.util.CharsetUtil; import io.netty.util.CharsetUtil;
public class HttpResponseHandler extends SimpleChannelUpstreamHandler { public class HttpUploadClientHandler extends SimpleChannelUpstreamHandler {
private volatile boolean readingChunks; private volatile boolean readingChunks;

View File

@ -27,10 +27,10 @@ import io.netty.handler.codec.http.HttpContentDecompressor;
import io.netty.handler.ssl.SslHandler; import io.netty.handler.ssl.SslHandler;
import io.netty.handler.stream.ChunkedWriteHandler; import io.netty.handler.stream.ChunkedWriteHandler;
public class HttpClientPipelineFactory implements ChannelPipelineFactory { public class HttpUploadClientPipelineFactory implements ChannelPipelineFactory {
private final boolean ssl; private final boolean ssl;
public HttpClientPipelineFactory(boolean ssl) { public HttpUploadClientPipelineFactory(boolean ssl) {
this.ssl = ssl; this.ssl = ssl;
} }
@ -56,7 +56,7 @@ public class HttpClientPipelineFactory implements ChannelPipelineFactory {
// to be used since huge file transfer // to be used since huge file transfer
pipeline.addLast("chunkedWriter", new ChunkedWriteHandler()); pipeline.addLast("chunkedWriter", new ChunkedWriteHandler());
pipeline.addLast("handler", new HttpResponseHandler()); pipeline.addLast("handler", new HttpUploadClientHandler());
return pipeline; return pipeline;
} }
} }

View File

@ -23,7 +23,7 @@ import io.netty.channel.socket.nio.NioServerSocketChannelFactory;
/** /**
*/ */
public class HttpServer { public class HttpUploadServer {
public static void main(String[] args) { public static void main(String[] args) {
// Configure the server. // Configure the server.
ServerBootstrap bootstrap = new ServerBootstrap( ServerBootstrap bootstrap = new ServerBootstrap(
@ -32,7 +32,7 @@ public class HttpServer {
Executors.newCachedThreadPool())); Executors.newCachedThreadPool()));
// Set up the event pipeline factory. // Set up the event pipeline factory.
bootstrap.setPipelineFactory(new HttpServerPipelineFactory()); bootstrap.setPipelineFactory(new HttpUploadServerPipelineFactory());
// Bind and start to accept incoming connections. // Bind and start to accept incoming connections.
bootstrap.bind(new InetSocketAddress(8080)); bootstrap.bind(new InetSocketAddress(8080));

View File

@ -60,7 +60,7 @@ import io.netty.handler.codec.http.InterfaceHttpData.HttpDataType;
import io.netty.handler.codec.http.QueryStringDecoder; import io.netty.handler.codec.http.QueryStringDecoder;
import io.netty.util.CharsetUtil; import io.netty.util.CharsetUtil;
public class HttpRequestHandler extends SimpleChannelUpstreamHandler { public class HttpUploadServerHandler extends SimpleChannelUpstreamHandler {
private volatile HttpRequest request; private volatile HttpRequest request;

View File

@ -23,7 +23,7 @@ import io.netty.handler.codec.http.HttpContentCompressor;
import io.netty.handler.codec.http.HttpRequestDecoder; import io.netty.handler.codec.http.HttpRequestDecoder;
import io.netty.handler.codec.http.HttpResponseEncoder; import io.netty.handler.codec.http.HttpResponseEncoder;
public class HttpServerPipelineFactory implements ChannelPipelineFactory { public class HttpUploadServerPipelineFactory implements ChannelPipelineFactory {
@Override @Override
public ChannelPipeline getPipeline() throws Exception { public ChannelPipeline getPipeline() throws Exception {
// Create a default pipeline implementation. // Create a default pipeline implementation.
@ -41,7 +41,7 @@ public class HttpServerPipelineFactory implements ChannelPipelineFactory {
// Remove the following line if you don't want automatic content compression. // Remove the following line if you don't want automatic content compression.
pipeline.addLast("deflater", new HttpContentCompressor()); pipeline.addLast("deflater", new HttpContentCompressor());
pipeline.addLast("handler", new HttpRequestHandler()); pipeline.addLast("handler", new HttpUploadServerHandler());
return pipeline; return pipeline;
} }
} }