rabbit.proxy
Class SWC

java.lang.Object
  extended by rabbit.proxy.SWC
All Implemented Interfaces:
AsyncListener, HttpHeaderListener, HttpHeaderSentListener, WebConnectionListener, ClientResourceTransferredListener

public class SWC
extends Object
implements HttpHeaderSentListener, HttpHeaderListener, WebConnectionListener, ClientResourceTransferredListener

A class that tries to establish a connection to the real server or the next proxy in the chain.

Author:
Robert Olofsson

Constructor Summary
SWC(Connection con, HttpHeader header, TrafficLoggerHandler tlh, ClientResourceHandler crh, rabbit.proxy.RequestHandler rh)
           
 
Method Summary
 void clientResourceAborted(HttpHeader reason)
          The transfer of the client resource has been aborted.
 void clientResourceTransferred()
          The client resource have been successfully transferred.
 void closed()
          The other end closed the connection.
 void connectionEstablished(WebConnection wc)
          A connection has been made.
 void establish()
           
 void failed(Exception e)
          Reading failed
 void httpHeaderRead(HttpHeader header, BufferHandle wbh, boolean keepalive, boolean isChunked, long dataSize)
          one http header has been read
 void httpHeaderSent()
          The http header has been sent.
 void timeout()
          The operation timed out
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SWC

public SWC(Connection con,
           HttpHeader header,
           TrafficLoggerHandler tlh,
           ClientResourceHandler crh,
           rabbit.proxy.RequestHandler rh)
Method Detail

establish

public void establish()

connectionEstablished

public void connectionEstablished(WebConnection wc)
Description copied from interface: WebConnectionListener
A connection has been made.

Specified by:
connectionEstablished in interface WebConnectionListener
Parameters:
wc - the now open connection

httpHeaderSent

public void httpHeaderSent()
Description copied from interface: HttpHeaderSentListener
The http header has been sent.

Specified by:
httpHeaderSent in interface HttpHeaderSentListener

clientResourceTransferred

public void clientResourceTransferred()
Description copied from interface: ClientResourceTransferredListener
The client resource have been successfully transferred.

Specified by:
clientResourceTransferred in interface ClientResourceTransferredListener

clientResourceAborted

public void clientResourceAborted(HttpHeader reason)
Description copied from interface: ClientResourceTransferredListener
The transfer of the client resource has been aborted.

Specified by:
clientResourceAborted in interface ClientResourceTransferredListener
Parameters:
reason - the failure code.

httpHeaderRead

public void httpHeaderRead(HttpHeader header,
                           BufferHandle wbh,
                           boolean keepalive,
                           boolean isChunked,
                           long dataSize)
Description copied from interface: HttpHeaderListener
one http header has been read

Specified by:
httpHeaderRead in interface HttpHeaderListener
Parameters:
header - the HttpHeader that was read
wbh - the BufferHandle that may or may not hold unread data.
keepalive - if the sender want to use keepalive.
isChunked - if false content is not chunked, if true content is chunked.
dataSize - the contents size or -1 if size is unknown.

closed

public void closed()
Description copied from interface: HttpHeaderListener
The other end closed the connection. Quite common on persistent connections.

Specified by:
closed in interface HttpHeaderListener

timeout

public void timeout()
Description copied from interface: AsyncListener
The operation timed out

Specified by:
timeout in interface AsyncListener
Specified by:
timeout in interface WebConnectionListener

failed

public void failed(Exception e)
Description copied from interface: AsyncListener
Reading failed

Specified by:
failed in interface AsyncListener
Specified by:
failed in interface WebConnectionListener
Parameters:
e - the real reason the operation failed.