org.apache.commons.httpclient
Class ProxyClient

java.lang.Object
  extended by org.apache.commons.httpclient.ProxyClient

public class ProxyClient
extends Object

A client that provides sockets for communicating through HTTP proxies via the HTTP CONNECT method. This is primarily needed for non-HTTP protocols that wish to communicate via an HTTP proxy.

Since:
3.0
Version:
$Revision: 354155 $
Author:
Oleg Kalnichevski, Michael Becke

Nested Class Summary
static class ProxyClient.ConnectResponse
          Contains the method used to execute the connect along with the created socket.
 
Constructor Summary
ProxyClient()
          Creates an instance of ProxyClient using default parameter set.
ProxyClient(HttpClientParams params)
          Creates an instance of ProxyClient using the given parameter set.
 
Method Summary
 ProxyClient.ConnectResponse connect()
          Creates a socket that is connected, via the HTTP CONNECT method, to a proxy.
 HostConfiguration getHostConfiguration()
          Returns the host configuration associated with the ProxyClient.
 HttpClientParams getParams()
          Returns HTTP protocol parameters associated with this ProxyClient.
 HttpState getState()
          Returns HTTP state associated with the ProxyClient.
 void setHostConfiguration(HostConfiguration hostConfiguration)
          Assigns the host configuration to use with the ProxyClient.
 void setParams(HttpClientParams params)
          Assigns HTTP protocol parameters for this ProxyClient.
 void setState(HttpState state)
          Assigns HTTP state for the ProxyClient.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxyClient

public ProxyClient()
Creates an instance of ProxyClient using default parameter set.

See Also:
HttpClientParams

ProxyClient

public ProxyClient(HttpClientParams params)
Creates an instance of ProxyClient using the given parameter set.

Parameters:
params - The parameters to use.
See Also:
HttpClientParams
Method Detail

getState

public HttpState getState()
Returns HTTP state associated with the ProxyClient.

Returns:
the shared client state
See Also:
setState(HttpState)

setState

public void setState(HttpState state)
Assigns HTTP state for the ProxyClient.

Parameters:
state - the new HTTP state for the client
See Also:
getState()

getHostConfiguration

public HostConfiguration getHostConfiguration()
Returns the host configuration associated with the ProxyClient.

Returns:
host configuration

setHostConfiguration

public void setHostConfiguration(HostConfiguration hostConfiguration)
Assigns the host configuration to use with the ProxyClient.

Parameters:
hostConfiguration - The host configuration to set

getParams

public HttpClientParams getParams()
Returns HTTP protocol parameters associated with this ProxyClient.

Returns:
associated parameters
See Also:
HttpClientParams

setParams

public void setParams(HttpClientParams params)
Assigns HTTP protocol parameters for this ProxyClient.

Parameters:
params - params to set
See Also:
HttpClientParams

connect

public ProxyClient.ConnectResponse connect()
                                    throws IOException,
                                           HttpException
Creates a socket that is connected, via the HTTP CONNECT method, to a proxy.

Even though HTTP CONNECT proxying is generally used for HTTPS tunneling, the returned socket will not have been wrapped in an SSL socket.

Both the proxy and destination hosts must be set via the host configuration prior to calling this method.

Returns:
the connect response
Throws:
IOException
HttpException
See Also:
getHostConfiguration()


Copyright (c) 1999-2005 - Apache Software Foundation