This commit is contained in:
Trustin Lee 2009-06-18 08:38:44 +00:00
parent e1abd56c1d
commit fae9900211
6 changed files with 27 additions and 6 deletions

View File

@ -25,6 +25,9 @@ import java.net.SocketAddress;
import java.net.URI;
/**
* Represents the URI of {@link HttpTunnelingServlet} where
* {@link HttpTunnelingClientSocketChannelFactory} connects to.
*
* @author The Netty Project (netty-dev@lists.jboss.org)
* @author Andy Taylor (andy.taylor@jboss.org)
* @author Trustin Lee (tlee@redhat.com)
@ -36,6 +39,9 @@ public class HttpTunnelAddress extends SocketAddress implements Comparable<HttpT
private final URI uri;
/**
* Creates a new instance with the specified URI.
*/
public HttpTunnelAddress(URI uri) {
if (uri == null) {
throw new NullPointerException("uri");
@ -43,6 +49,9 @@ public class HttpTunnelAddress extends SocketAddress implements Comparable<HttpT
this.uri = uri;
}
/**
* Returns the {@link URI} where {@link HttpTunnelingServlet} is bound.
*/
public URI getUri() {
return uri;
}

View File

@ -34,6 +34,7 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpSession;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.ChannelHandler;
import org.jboss.netty.channel.ChannelHandlerContext;
import org.jboss.netty.channel.ChannelPipelineCoverage;
import org.jboss.netty.channel.ChannelStateEvent;
@ -44,7 +45,8 @@ import org.jboss.netty.logging.InternalLogger;
import org.jboss.netty.logging.InternalLoggerFactory;
/**
* A channel handler that proxies messages to the servlet output stream
* A {@link ChannelHandler} that proxies received messages to the
* {@link OutputStream} of the {@link HttpTunnelingServlet}.
*
* @author The Netty Project (netty-dev@lists.jboss.org)
* @author Andy Taylor (andy.taylor@jboss.org)

View File

@ -31,6 +31,10 @@ import org.jboss.netty.channel.socket.SocketChannel;
import org.jboss.netty.util.internal.ExecutorUtil;
/**
* A {@link ClientSocketChannelFactory} that creates a {@link SocketChannel}
* which connects to an {@link HttpTunnelingServlet} to communicate with the
* server application behind the {@link HttpTunnelingServlet}.
*
* @author The Netty Project (netty-dev@lists.jboss.org)
* @author Andy Taylor (andy.taylor@jboss.org)
* @author Trustin Lee (tlee@redhat.com)
@ -78,6 +82,7 @@ public class HttpTunnelingClientSocketChannelFactory implements ClientSocketChan
}
public void releaseExternalResources() {
clientSocketChannelFactory.releaseExternalResources();
ExecutorUtil.terminate(workerExecutor);
}
}

View File

@ -27,10 +27,12 @@ import javax.servlet.ServletContextListener;
import org.jboss.netty.bootstrap.ClientBootstrap;
import org.jboss.netty.channel.ChannelFactory;
import org.jboss.netty.channel.local.DefaultLocalClientChannelFactory;
import org.jboss.netty.channel.local.LocalClientChannelFactory;
/**
* A context listener that creates a client bootstrap that uses a local channel factory. The local channel factory should
* already be registered before the contect is loaded.
* A {@link ServletContextListener} that creates a {@link ClientBootstrap}
* using a {@link LocalClientChannelFactory}. The factory should be registered
* before this context is loaded.
*
* @author The Netty Project (netty-dev@lists.jboss.org)
* @author Andy Taylor (andy.taylor@jboss.org)
@ -65,5 +67,4 @@ public class HttpTunnelingContextListener implements ServletContextListener {
public void contextDestroyed(ServletContextEvent context) {
// Unused
}
}

View File

@ -38,7 +38,8 @@ import org.jboss.netty.channel.Channel;
import org.jboss.netty.channel.MessageEvent;
/**
* A Servlet that acts as a proxy for a netty channel
* An {@link HttpServlet} that proxies an incoming data to the actual server
* and vice versa.
*
* @author The Netty Project (netty-dev@lists.jboss.org)
* @author Andy Taylor (andy.taylor@jboss.org)

View File

@ -25,6 +25,7 @@ import static org.jboss.netty.channel.Channels.*;
import static org.jboss.netty.channel.socket.http.HttpTunnelingContextListener.*;
import static org.jboss.netty.channel.socket.http.HttpTunnelingServlet.*;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
@ -38,7 +39,9 @@ import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.channel.local.LocalAddress;
/**
* A session listener that uses the client bootstrap to create a channel.
* An {@link HttpSessionListener} that creates an outbound connection to the
* actual server behind {@link HttpServlet}. The outbound connection is open
* when a new session is created, and closed when the session is destroyed.
*
* @author The Netty Project (netty-dev@lists.jboss.org)
* @author Andy Taylor (andy.taylor@jboss.org)