HttpProxy (RabbIT/4)
Date: 2009-12-20

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rabbit.proxy
Class HttpProxy

    java.lang.Object
      rabbit.proxy.HttpProxy

All Implemented Interfaces:
  Resolver

    public class HttpProxy

extends Object
implements Resolver

A filtering and caching http proxy.

Author:
  Robert Olofsson

Field Summary
`protected boolean` | `proxySSL` Are we allowed to proxy ssl?
`protected List<Integer>` | `sslports` The List of acceptable ssl-ports.
`static String` | `VERSION` Current version

Constructor Summary
`HttpProxy()`

Method Summary
`void` | `addCurrentConnection(Connection con)` Add a current connection
`protected BufferHandler` | `getBufferHandler()`
`Cache<HttpHeader,HttpHeader>` | `getCache()`
`Config` | `getConfig()` Get the configuration of the proxy.
`ConnectionHandler` | `getConnectionHandler()` Get the connection handler.
`int` | `getConnectPort(int port)` Get the port to connect to.
`Counter` | `getCounter()`
`List<Connection>` | `getCurrentConnections()` Get all the current connections
`InetAddress` | `getHost()` Get the local host.
`void` | `getInetAddress(URL url, InetAddressListener ial)` Get the InetAddress for a given url.
`NioHandler` | `getNioHandler()`
`long` | `getOffset()`
`int` | `getPort()` Get the port this proxy is using.
`String` | `getProxyAuthString()` Get the authenticationstring to use for proxy.
`String` | `getServerIdentity()`
`long` | `getStartTime()`
`boolean` | `getStrictHttp()`
`TrafficLoggerHandler` | `getTrafficLoggerHandler()` Get the currently transferred traffic statistics.
`String` | `getVersion()`
`void` | `getWebConnection(HttpHeader header, WebConnectionListener wcl)` Get a WebConnection.
`boolean` | `isProxyConnected()` Is this proxy chained to another proxy?
`boolean` | `isSelf(String uhost, int urlport)` Try hard to check if the given address matches the proxy.
`void` | `markForPipelining(WebConnection wc)` Mark a WebConnection for pipelining.
`void` | `releaseWebConnection(WebConnection wc)` Release a WebConnection so that it may be reused if possible.
`void` | `removeCurrentConnection(Connection con)` Remove a current connection.
`void` | `setConfig(String conf)` Set the config file to use for this proxy.
`void` | `setStrictHttp(boolean b)`
`void` | `start()` Run the proxy in a separate thread.
`void` | `stop()` Run the proxy in a separate thread.
`protected void` | `updateTrafficLog(TrafficLoggerHandler tlh)` Update the currently transferred traffic statistics.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### VERSION

    public static final String VERSION

  Current version

  See Also:
    Constant Field Values

### proxySSL

    protected boolean proxySSL

  Are we allowed to proxy ssl?

### sslports

    protected List<Integer> sslports

  The List of acceptable ssl-ports.

Constructor Detail

### HttpProxy

    public HttpProxy()
              throws UnknownHostException

Throws:
  `UnknownHostException`

Method Detail

### setConfig

    public void setConfig(String conf)
                   throws IOException

  Set the config file to use for this proxy.

  Parameters:
    `conf` - the name of the file to use for proxy configuration.
  Throws:
    `IOException`

### setStrictHttp

    public void setStrictHttp(boolean b)

### getStrictHttp

    public boolean getStrictHttp()

### start

    public void start()

  Run the proxy in a separate thread.

### stop

    public void stop()

  Run the proxy in a separate thread.

### getNioHandler

    public NioHandler getNioHandler()

### getCache

    public Cache<HttpHeader,HttpHeader> getCache()

### getOffset

    public long getOffset()

### getStartTime

    public long getStartTime()

### getCounter

    public Counter getCounter()

### getConfig

    public Config getConfig()

  Get the configuration of the proxy.

### getVersion

    public String getVersion()

### getServerIdentity

    public String getServerIdentity()

### getHost

    public InetAddress getHost()

  Get the local host.

  Returns:
    the InetAddress of the host the proxy is running on.

### getPort

    public int getPort()

  Get the port this proxy is using.

  Returns:
    the port number the proxy is listening on.

### getInetAddress

    public void getInetAddress(URL url,
                               InetAddressListener ial)

  Get the InetAddress for a given url. We do dns lookups on a separate thread until we have an asyncronous dns library. We jump back on the main thread before telling the listener.

  Specified by:
    `getInetAddress` in interface `Resolver`
  Parameters:
    `url` - the URL to lookup.
    `ial` - the InetAddressListener to notify when lookup is done.

### getConnectPort

    public int getConnectPort(int port)

  Get the port to connect to.

  Specified by:
    `getConnectPort` in interface `Resolver`
  Parameters:
    `port` - the port we want to connect to.
  Returns:
    the port to connect to.

### isSelf

    public boolean isSelf(String uhost,
                          int urlport)

  Try hard to check if the given address matches the proxy. Will use the localhost name and all ip addresses.

### isProxyConnected

    public boolean isProxyConnected()

  Is this proxy chained to another proxy?

  Specified by:
    `isProxyConnected` in interface `Resolver`
  Returns:
    true if the proxy is connected to another proxy.

### getProxyAuthString

    public String getProxyAuthString()

  Get the authenticationstring to use for proxy.

  Specified by:
    `getProxyAuthString` in interface `Resolver`
  Returns:
    an authentication string.

### getWebConnection

    public void getWebConnection(HttpHeader header,
                                 WebConnectionListener wcl)

  Get a WebConnection.

  Parameters:
    `header` - the http header to get the host and port from
    `wcl` - the listener that wants to get the connection.

### releaseWebConnection

    public void releaseWebConnection(WebConnection wc)

  Release a WebConnection so that it may be reused if possible.

  Parameters:
    `wc` - the WebConnection to release.

### markForPipelining

    public void markForPipelining(WebConnection wc)

  Mark a WebConnection for pipelining.

  Parameters:
    `wc` - the WebConnection to mark.

### addCurrentConnection

    public void addCurrentConnection(Connection con)

  Add a current connection

  Parameters:
    `con` - the connection

### removeCurrentConnection

    public void removeCurrentConnection(Connection con)

  Remove a current connection.

  Parameters:
    `con` - the connection

### getConnectionHandler

    public ConnectionHandler getConnectionHandler()

  Get the connection handler.

### getCurrentConnections

    public List<Connection> getCurrentConnections()

  Get all the current connections

### updateTrafficLog

    protected void updateTrafficLog(TrafficLoggerHandler tlh)

  Update the currently transferred traffic statistics.

### getTrafficLoggerHandler

    public TrafficLoggerHandler getTrafficLoggerHandler()

  Get the currently transferred traffic statistics.

### getBufferHandler

    protected BufferHandler getBufferHandler()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD