Package jodd.http
Class HttpTunnel
- java.lang.Object
-
- jodd.http.HttpTunnel
-
public class HttpTunnel extends java.lang.ObjectSimple HTTP tunnel base ready to be extended.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classHttpTunnel.HttpTunnelConnectionSingle connection handler that performs the tunneling.
-
Field Summary
Fields Modifier and Type Field Description protected java.util.concurrent.ExecutorServiceexecutorServiceprotected intlistenPortTunnel listening port.protected booleanrunningprotected java.net.ServerSocketserverSocketprotected intsocketBacklogNumber of incoming sockets connection that can be hold before processing each.protected java.lang.StringtargetHostTarget host.protected inttargetPortTarget port.protected intthreadPoolSizeThe number of threads that can be executed in parallel.
-
Constructor Summary
Constructors Constructor Description HttpTunnel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.RunnableonSocketConnection(java.net.Socket socket)Invoked on incoming connection.voidstart()Starts HTTP tunnel.voidstop()Stops the tunnel, shutdowns the thread pool and closes server socket.
-
-
-
Field Detail
-
threadPoolSize
protected int threadPoolSize
The number of threads that can be executed in parallel.
-
socketBacklog
protected int socketBacklog
Number of incoming sockets connection that can be hold before processing each.
-
listenPort
protected int listenPort
Tunnel listening port.
-
targetHost
protected java.lang.String targetHost
Target host.
-
targetPort
protected int targetPort
Target port.
-
executorService
protected java.util.concurrent.ExecutorService executorService
-
running
protected volatile boolean running
-
serverSocket
protected java.net.ServerSocket serverSocket
-
-
Method Detail
-
start
public void start() throws java.io.IOExceptionStarts HTTP tunnel. Method ends when the tunnel is stopped.- Throws:
java.io.IOException
-
onSocketConnection
protected java.lang.Runnable onSocketConnection(java.net.Socket socket)
Invoked on incoming connection. By default returnsHttpTunnel.HttpTunnelConnectionto handle the connection. May be used to return custom handlers.
-
stop
public void stop()
Stops the tunnel, shutdowns the thread pool and closes server socket.
-
-