Package jodd.http
Class HttpTunnel.HttpTunnelConnection
- java.lang.Object
-
- jodd.http.HttpTunnel.HttpTunnelConnection
-
- All Implemented Interfaces:
java.lang.Runnable
- Enclosing class:
- HttpTunnel
public class HttpTunnel.HttpTunnelConnection extends java.lang.Object implements java.lang.RunnableSingle connection handler that performs the tunneling.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.net.Socketsocket
-
Constructor Summary
Constructors Constructor Description HttpTunnelConnection(java.net.Socket socket)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidonRequest(HttpRequest request)Invoked after income connection is parsed.protected voidonResponse(HttpResponse response)Invoked after target response is processed.voidrun()protected voidtunnel()Performs the tunneling.
-
-
-
Method Detail
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
onRequest
protected void onRequest(HttpRequest request)
Invoked after income connection is parsed. Nothing is changed in the request, except the target host and port.
-
onResponse
protected void onResponse(HttpResponse response)
Invoked after target response is processed. Response is now ready to be sent back to the client. The following header parameters are changed:- Transfer-Encoding is removed, as body is returned at once,
- Content-Length is added/update to body size.
-
tunnel
protected void tunnel() throws java.io.IOExceptionPerforms the tunneling. The following steps occurs:- read and parse clients request
- open socket to target
- resend request to target
- read targets response
- fix response and resend it to client
- Throws:
java.io.IOException
-
-