org.apache.commons.httpclient

Class ProxyClient

public class ProxyClient extends Object

A client that provides {@link java.net.Socket 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 classProxyClient.ConnectResponse
Contains the method used to execute the connect along with the created socket.
Constructor Summary
ProxyClient()
Creates an instance of ProxyClient using default {@link HttpClientParams parameter set}.
ProxyClient(HttpClientParams params)
Creates an instance of ProxyClient using the given {@link HttpClientParams parameter set}.
Method Summary
ProxyClient.ConnectResponseconnect()
Creates a socket that is connected, via the HTTP CONNECT method, to a proxy.
HostConfigurationgetHostConfiguration()
Returns the {@link HostConfiguration host configuration} associated with the ProxyClient.
HttpClientParamsgetParams()
Returns {@link HttpClientParams HTTP protocol parameters} associated with this ProxyClient.
HttpStategetState()
Returns {@link HttpState HTTP state} associated with the ProxyClient.
voidsetHostConfiguration(HostConfiguration hostConfiguration)
Assigns the {@link HostConfiguration host configuration} to use with the ProxyClient.
voidsetParams(HttpClientParams params)
Assigns {@link HttpClientParams HTTP protocol parameters} for this ProxyClient.
voidsetState(HttpState state)
Assigns {@link HttpState HTTP state} for the ProxyClient.

Constructor Detail

ProxyClient

public ProxyClient()
Creates an instance of ProxyClient using default {@link HttpClientParams parameter set}.

See Also: HttpClientParams

ProxyClient

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

Parameters: params The {@link HttpClientParams parameters} to use.

See Also: HttpClientParams

Method Detail

connect

public ProxyClient.ConnectResponse connect()
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 {@link #getHostConfiguration() host configuration} prior to calling this method.

Returns: the connect response

Throws: IOException HttpException

See Also: getHostConfiguration

getHostConfiguration

public HostConfiguration getHostConfiguration()
Returns the {@link HostConfiguration host configuration} associated with the ProxyClient.

Returns: {@link HostConfiguration host configuration}

getParams

public HttpClientParams getParams()
Returns {@link HttpClientParams HTTP protocol parameters} associated with this ProxyClient.

See Also: HttpClientParams

getState

public HttpState getState()
Returns {@link HttpState HTTP state} associated with the ProxyClient.

Returns: the shared client state

See Also: setState

setHostConfiguration

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

Parameters: hostConfiguration The {@link HostConfiguration host configuration} to set

setParams

public void setParams(HttpClientParams params)
Assigns {@link HttpClientParams HTTP protocol parameters} for this ProxyClient.

See Also: HttpClientParams

setState

public void setState(HttpState state)
Assigns {@link HttpState HTTP state} for the ProxyClient.

Parameters: state the new {@link HttpState HTTP state} for the client

See Also: getState

Copyright (c) 1999-2005 - Apache Software Foundation