jodd.io.http
Class HttpTunnel.HttpTunnelConnection

java.lang.Object
  extended by jodd.io.http.HttpTunnel.HttpTunnelConnection
All Implemented Interfaces:
java.lang.Runnable
Enclosing class:
HttpTunnel

public class HttpTunnel.HttpTunnelConnection
extends java.lang.Object
implements java.lang.Runnable

Single connection handler that performs the tunneling.


Field Summary
protected  java.net.Socket socket
           
 
Constructor Summary
HttpTunnel.HttpTunnelConnection(java.net.Socket socket)
           
 
Method Summary
protected  void onRequest(HttpTransfer request)
          Invoked after income connection is parsed.
protected  void onResponse(HttpTransfer response)
          Invoked after target response is processed.
 void run()
           
protected  void tunnel()
          Performs the tunneling.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

socket

protected final java.net.Socket socket
Constructor Detail

HttpTunnel.HttpTunnelConnection

public HttpTunnel.HttpTunnelConnection(java.net.Socket socket)
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable

onRequest

protected void onRequest(HttpTransfer request)
Invoked after income connection is parsed. Nothing is changed in the request. Sometimes, it make sense to modify the "Host" header to match the target.


onResponse

protected void onResponse(HttpTransfer 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.IOException
    Performs 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


  • Copyright © 2003-2012 Jodd Team