From 3922fb8a442f5d530d1ca31c6d140f0b58b890c4 Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Tue, 17 Feb 2009 09:45:32 +0000 Subject: [PATCH] HttpTunnelClientSocket -> HttpTunnelingClientSocket HttpTunnelSocket -> HttpTunnelingSocket --- .../channel/socket/http/HttpTunnelWorker.java | 10 ++++---- ... => HttpTunnelingClientSocketChannel.java} | 24 +++++++++---------- ...pTunnelingClientSocketChannelFactory.java} | 10 ++++---- ...ttpTunnelingClientSocketPipelineSink.java} | 10 ++++---- ... => HttpTunnelingSocketChannelConfig.java} | 8 +++---- 5 files changed, 31 insertions(+), 31 deletions(-) rename src/main/java/org/jboss/netty/channel/socket/http/{HttpTunnelClientSocketChannel.java => HttpTunnelingClientSocketChannel.java} (88%) rename src/main/java/org/jboss/netty/channel/socket/http/{HttpTunnelClientSocketChannelFactory.java => HttpTunnelingClientSocketChannelFactory.java} (85%) rename src/main/java/org/jboss/netty/channel/socket/http/{HttpTunnelClientSocketPipelineSink.java => HttpTunnelingClientSocketPipelineSink.java} (92%) rename src/main/java/org/jboss/netty/channel/socket/http/{HttpTunnelSocketChannelConfig.java => HttpTunnelingSocketChannelConfig.java} (96%) diff --git a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelWorker.java b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelWorker.java index 58f8288316..99c2ff59f4 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelWorker.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelWorker.java @@ -35,9 +35,9 @@ import org.jboss.netty.channel.ChannelFuture; * @version $Rev$, $Date$ */ class HttpTunnelWorker implements Runnable { - private final HttpTunnelClientSocketChannel channel; + private final HttpTunnelingClientSocketChannel channel; - HttpTunnelWorker(HttpTunnelClientSocketChannel channel) { + HttpTunnelWorker(HttpTunnelingClientSocketChannel channel) { this.channel = channel; } @@ -85,7 +85,7 @@ class HttpTunnelWorker implements Runnable { } static void write( - HttpTunnelClientSocketChannel channel, ChannelFuture future, + HttpTunnelingClientSocketChannel channel, ChannelFuture future, Object message) { try { @@ -99,7 +99,7 @@ class HttpTunnelWorker implements Runnable { } static void setInterestOps( - HttpTunnelClientSocketChannel channel, ChannelFuture future, int interestOps) { + HttpTunnelingClientSocketChannel channel, ChannelFuture future, int interestOps) { // Override OP_WRITE flag - a user cannot change this flag. interestOps &= ~Channel.OP_WRITE; @@ -136,7 +136,7 @@ class HttpTunnelWorker implements Runnable { } } - static void close(HttpTunnelClientSocketChannel channel, ChannelFuture future) { + static void close(HttpTunnelingClientSocketChannel channel, ChannelFuture future) { boolean connected = channel.isConnected(); boolean bound = channel.isBound(); try { diff --git a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelClientSocketChannel.java b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelingClientSocketChannel.java similarity index 88% rename from src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelClientSocketChannel.java rename to src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelingClientSocketChannel.java index cf26233419..5c7b635e4d 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelClientSocketChannel.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelingClientSocketChannel.java @@ -55,7 +55,7 @@ import org.jboss.netty.util.LinkedTransferQueue; * @author Andy Taylor (andy.taylor@jboss.org) * @version $Rev$, $Date$ */ -class HttpTunnelClientSocketChannel extends AbstractChannel +class HttpTunnelingClientSocketChannel extends AbstractChannel implements org.jboss.netty.channel.socket.SocketChannel { private final Lock reconnectLock = new ReentrantLock(); @@ -78,11 +78,11 @@ class HttpTunnelClientSocketChannel extends AbstractChannel private final DelimiterBasedFrameDecoder handler = new DelimiterBasedFrameDecoder(8092, ChannelBuffers.wrappedBuffer(new byte[] { '\r', '\n' })); - private final HttpTunnelClientSocketChannel.ServletChannelHandler servletHandler = new ServletChannelHandler(); + private final HttpTunnelingClientSocketChannel.ServletChannelHandler servletHandler = new ServletChannelHandler(); private HttpTunnelAddress remoteAddress; - HttpTunnelClientSocketChannel( + HttpTunnelingClientSocketChannel( ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink, ClientSocketChannelFactory clientSocketChannelFactory) { @@ -150,26 +150,26 @@ class HttpTunnelClientSocketChannel extends AbstractChannel SocketAddress connectAddress = new InetSocketAddress(url.getHost(), url.getPort()); channel.connect(connectAddress); StringBuilder builder = new StringBuilder(); - builder.append("POST ").append(url.getRawPath()).append(" HTTP/1.1").append(HttpTunnelClientSocketPipelineSink.LINE_TERMINATOR). - append("HOST: ").append(url.getHost()).append(":").append(url.getPort()).append(HttpTunnelClientSocketPipelineSink.LINE_TERMINATOR). - append("Content-Type: application/octet-stream").append(HttpTunnelClientSocketPipelineSink.LINE_TERMINATOR).append("Transfer-Encoding: chunked"). - append(HttpTunnelClientSocketPipelineSink.LINE_TERMINATOR).append("Content-Transfer-Encoding: Binary").append(HttpTunnelClientSocketPipelineSink.LINE_TERMINATOR).append("Connection: Keep-Alive"). - append(HttpTunnelClientSocketPipelineSink.LINE_TERMINATOR); + builder.append("POST ").append(url.getRawPath()).append(" HTTP/1.1").append(HttpTunnelingClientSocketPipelineSink.LINE_TERMINATOR). + append("HOST: ").append(url.getHost()).append(":").append(url.getPort()).append(HttpTunnelingClientSocketPipelineSink.LINE_TERMINATOR). + append("Content-Type: application/octet-stream").append(HttpTunnelingClientSocketPipelineSink.LINE_TERMINATOR).append("Transfer-Encoding: chunked"). + append(HttpTunnelingClientSocketPipelineSink.LINE_TERMINATOR).append("Content-Transfer-Encoding: Binary").append(HttpTunnelingClientSocketPipelineSink.LINE_TERMINATOR).append("Connection: Keep-Alive"). + append(HttpTunnelingClientSocketPipelineSink.LINE_TERMINATOR); if (reconnect) { - builder.append("Cookie: JSESSIONID=").append(sessionId).append(HttpTunnelClientSocketPipelineSink.LINE_TERMINATOR); + builder.append("Cookie: JSESSIONID=").append(sessionId).append(HttpTunnelingClientSocketPipelineSink.LINE_TERMINATOR); } - builder.append(HttpTunnelClientSocketPipelineSink.LINE_TERMINATOR); + builder.append(HttpTunnelingClientSocketPipelineSink.LINE_TERMINATOR); String msg = builder.toString(); channel.write(ChannelBuffers.wrappedBuffer(msg.getBytes("ASCII7"))); } public void sendChunk(ChannelBuffer a) { int size = a.readableBytes(); - String hex = Integer.toHexString(size) + HttpTunnelClientSocketPipelineSink.LINE_TERMINATOR; + String hex = Integer.toHexString(size) + HttpTunnelingClientSocketPipelineSink.LINE_TERMINATOR; // try { synchronized (writeLock) { - a.writeBytes(HttpTunnelClientSocketPipelineSink.LINE_TERMINATOR.getBytes()); + a.writeBytes(HttpTunnelingClientSocketPipelineSink.LINE_TERMINATOR.getBytes()); channel.write(ChannelBuffers.wrappedBuffer(hex.getBytes())); channel.write(a).awaitUninterruptibly(); //channel.write(ChannelBuffers.wrappedBuffer(LINE_TERMINATOR.getBytes())); diff --git a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelClientSocketChannelFactory.java b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelingClientSocketChannelFactory.java similarity index 85% rename from src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelClientSocketChannelFactory.java rename to src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelingClientSocketChannelFactory.java index 671da19676..dc0cf4ad30 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelClientSocketChannelFactory.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelingClientSocketChannelFactory.java @@ -35,7 +35,7 @@ import org.jboss.netty.util.ExecutorUtil; * @author Andy Taylor (andy.taylor@jboss.org) * @version $Rev$, $Date$ */ -public class HttpTunnelClientSocketChannelFactory implements ClientSocketChannelFactory { +public class HttpTunnelingClientSocketChannelFactory implements ClientSocketChannelFactory { private final Executor workerExecutor; private final ChannelSink sink; @@ -45,7 +45,7 @@ public class HttpTunnelClientSocketChannelFactory implements ClientSocketChannel * * @param workerExecutor */ - public HttpTunnelClientSocketChannelFactory(ClientSocketChannelFactory clientSocketChannelFactory, Executor workerExecutor) { + public HttpTunnelingClientSocketChannelFactory(ClientSocketChannelFactory clientSocketChannelFactory, Executor workerExecutor) { this(workerExecutor, Runtime.getRuntime().availableProcessors()); this.clientSocketChannelFactory = clientSocketChannelFactory; } @@ -58,7 +58,7 @@ public class HttpTunnelClientSocketChannelFactory implements ClientSocketChannel * the {@link java.util.concurrent.Executor} which will execute the I/O worker threads * @param workerCount */ - public HttpTunnelClientSocketChannelFactory( + public HttpTunnelingClientSocketChannelFactory( Executor workerExecutor, int workerCount) { if (workerExecutor == null) { @@ -71,11 +71,11 @@ public class HttpTunnelClientSocketChannelFactory implements ClientSocketChannel } this.workerExecutor = workerExecutor; - sink = new HttpTunnelClientSocketPipelineSink(workerExecutor); + sink = new HttpTunnelingClientSocketPipelineSink(workerExecutor); } public SocketChannel newChannel(ChannelPipeline pipeline) { - return new HttpTunnelClientSocketChannel(this, pipeline, sink, clientSocketChannelFactory); + return new HttpTunnelingClientSocketChannel(this, pipeline, sink, clientSocketChannelFactory); } public void releaseExternalResources() { diff --git a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelClientSocketPipelineSink.java b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelingClientSocketPipelineSink.java similarity index 92% rename from src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelClientSocketPipelineSink.java rename to src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelingClientSocketPipelineSink.java index 9739a6de66..27d51f56b8 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelClientSocketPipelineSink.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelingClientSocketPipelineSink.java @@ -42,18 +42,18 @@ import org.jboss.netty.util.ThreadRenamingRunnable; * @author Andy Taylor (andy.taylor@jboss.org) * @version $Rev$, $Date$ */ -class HttpTunnelClientSocketPipelineSink extends AbstractChannelSink { +class HttpTunnelingClientSocketPipelineSink extends AbstractChannelSink { static String LINE_TERMINATOR = "\r\n"; private final Executor workerExecutor; - HttpTunnelClientSocketPipelineSink(Executor workerExecutor) { + HttpTunnelingClientSocketPipelineSink(Executor workerExecutor) { this.workerExecutor = workerExecutor; } public void eventSunk( ChannelPipeline pipeline, ChannelEvent e) throws Exception { - HttpTunnelClientSocketChannel channel = (HttpTunnelClientSocketChannel) e.getChannel(); + HttpTunnelingClientSocketChannel channel = (HttpTunnelingClientSocketChannel) e.getChannel(); ChannelFuture future = e.getFuture(); if (e instanceof ChannelStateEvent) { ChannelStateEvent stateEvent = (ChannelStateEvent) e; @@ -91,7 +91,7 @@ class HttpTunnelClientSocketPipelineSink extends AbstractChannelSink { } private void bind( - HttpTunnelClientSocketChannel channel, ChannelFuture future, + HttpTunnelingClientSocketChannel channel, ChannelFuture future, SocketAddress localAddress) { try { channel.bindSocket(localAddress); @@ -104,7 +104,7 @@ class HttpTunnelClientSocketPipelineSink extends AbstractChannelSink { } private void connect( - HttpTunnelClientSocketChannel channel, ChannelFuture future, + HttpTunnelingClientSocketChannel channel, ChannelFuture future, HttpTunnelAddress remoteAddress) { boolean bound = channel.isBound(); diff --git a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelSocketChannelConfig.java b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelingSocketChannelConfig.java similarity index 96% rename from src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelSocketChannelConfig.java rename to src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelingSocketChannelConfig.java index d3c0f3a3d5..6fdd920800 100644 --- a/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelSocketChannelConfig.java +++ b/src/main/java/org/jboss/netty/channel/socket/http/HttpTunnelingSocketChannelConfig.java @@ -39,7 +39,7 @@ import org.jboss.netty.util.ConversionUtil; * @author Andy Taylor (andy.taylor@jboss.org) * @version $Rev$, $Date$ */ -public class HttpTunnelSocketChannelConfig implements SocketChannelConfig { +public class HttpTunnelingSocketChannelConfig implements SocketChannelConfig { final Socket socket; @@ -70,7 +70,7 @@ public class HttpTunnelSocketChannelConfig implements SocketChannelConfig { /** * Creates a new instance. */ - public HttpTunnelSocketChannelConfig(Socket socket) { + public HttpTunnelingSocketChannelConfig(Socket socket) { this.socket = socket; } @@ -315,8 +315,8 @@ public class HttpTunnelSocketChannelConfig implements SocketChannelConfig { // Unused } - HttpTunnelSocketChannelConfig copyConfig(Socket socket) { - HttpTunnelSocketChannelConfig config = new HttpTunnelSocketChannelConfig(socket); + HttpTunnelingSocketChannelConfig copyConfig(Socket socket) { + HttpTunnelingSocketChannelConfig config = new HttpTunnelingSocketChannelConfig(socket); config.setConnectTimeoutMillis(connectTimeoutMillis); if (trafficClass != null) { config.setTrafficClass(trafficClass);