Class HttpTunnelingServlet
- java.lang.Object
-
- javax.servlet.GenericServlet
-
- javax.servlet.http.HttpServlet
-
- org.jboss.netty.channel.socket.http.HttpTunnelingServlet
-
- All Implemented Interfaces:
java.io.Serializable
,javax.servlet.Servlet
,javax.servlet.ServletConfig
public class HttpTunnelingServlet extends javax.servlet.http.HttpServlet
AnHttpServlet
that proxies an incoming data to the actual server and vice versa. Please refer to the package summary for the detailed usage.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
HttpTunnelingServlet.OutboundConnectionHandler
-
Field Summary
Fields Modifier and Type Field Description private ChannelFactory
channelFactory
private static java.lang.String
CONNECT_ATTEMPTS
private long
connectAttempts
private static java.lang.String
ENDPOINT
(package private) static InternalLogger
logger
private java.net.SocketAddress
remoteAddress
private static java.lang.String
RETRY_DELAY
private long
retryDelay
private static long
serialVersionUID
-
Constructor Summary
Constructors Constructor Description HttpTunnelingServlet()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ChannelFactory
createChannelFactory(java.net.SocketAddress remoteAddress)
void
destroy()
protected void
destroyChannelFactory(ChannelFactory factory)
void
init()
protected java.net.SocketAddress
parseEndpoint(java.lang.String endpoint)
private static ChannelBuffer
read(java.io.PushbackInputStream in)
protected void
service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
-
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
ENDPOINT
private static final java.lang.String ENDPOINT
- See Also:
- Constant Field Values
-
CONNECT_ATTEMPTS
private static final java.lang.String CONNECT_ATTEMPTS
- See Also:
- Constant Field Values
-
RETRY_DELAY
private static final java.lang.String RETRY_DELAY
- See Also:
- Constant Field Values
-
logger
static final InternalLogger logger
-
remoteAddress
private volatile java.net.SocketAddress remoteAddress
-
channelFactory
private volatile ChannelFactory channelFactory
-
connectAttempts
private volatile long connectAttempts
-
retryDelay
private volatile long retryDelay
-
-
Method Detail
-
init
public void init() throws javax.servlet.ServletException
- Overrides:
init
in classjavax.servlet.GenericServlet
- Throws:
javax.servlet.ServletException
-
parseEndpoint
protected java.net.SocketAddress parseEndpoint(java.lang.String endpoint) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createChannelFactory
protected ChannelFactory createChannelFactory(java.net.SocketAddress remoteAddress) throws java.lang.Exception
- Throws:
java.lang.Exception
-
destroy
public void destroy()
- Specified by:
destroy
in interfacejavax.servlet.Servlet
- Overrides:
destroy
in classjavax.servlet.GenericServlet
-
destroyChannelFactory
protected void destroyChannelFactory(ChannelFactory factory) throws java.lang.Exception
- Throws:
java.lang.Exception
-
service
protected void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException, java.io.IOException
- Overrides:
service
in classjavax.servlet.http.HttpServlet
- Throws:
javax.servlet.ServletException
java.io.IOException
-
read
private static ChannelBuffer read(java.io.PushbackInputStream in) throws java.io.IOException
- Throws:
java.io.IOException
-
-