hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lalit Sahoo" <lali...@sonata-software.com>
Subject RE: HttpClient class
Date Wed, 14 Feb 2007 17:37:59 GMT
Hi Oleg,
 
Could you please explain in little detail how HttpClient is related to SSL tunneling,redirect
and authentication?
 
 
Regards,
Lalit

________________________________

From: Oleg Kalnichevski [mailto:olegk@apache.org]
Sent: Wed 2/14/2007 9:11 PM
To: HttpClient User Discussion
Subject: Re: HttpClient class



On Wed, 2007-02-14 at 21:00 +0530, Lalit Sahoo wrote:
> Hi All,
> 
> Can anybody help me?
> 
> Is it necessary to use HttpClient class?
> 

No, it is not. The SSL tunneling, request recovery, redirects and
authentication will not be handled automatically. That's all.


> If I will use following approach what will be the disadvantage?

It depends on what you want to achieve

Oleg


> 
>
> 1. Create a connection manager
>
> 
>
>             MultiThreadedHttpConnectionManager connManager = new MultiThreadedHttpConnectionManager
();
>
> 
>
> 2. Create a host configuration
>
> 
>
>             HostConfiguration hostConfig = new HostConfiguration ();
>
> 
>
> 3. Set the host and port for host configuration
>
> 
>
>             hostConfig.set (hostName, portNumber)
>
> 
>
> 4. Create an HttpState instance
>
> 
>
>             UsernamePasswordCredentials userCredentials = new UsernamePasswordCredentials
(userName, password);
>
>                 AuthScope authScope = new AuthScope (hostName, portNumber, realm, authenticationScheme);
>
>                 HttpState httpState = new HttpState ();
>
>                 httpState.setCredentials (authScope, userCredentials);
>
> 
>
> 5. Get an http connection with timeout:
>
> 
>
>             HttpConnection httpConnection = connManager.getConnectionWithTimeout (hostconfig,
1000);
>
> 
>
> 6. Create an instance of get method:
>
> 
>
>            
>
> String uri = "http://172.24.19.79:7001/SimpleWebSimulator/SOAPAgent";
>
> GetMethod getMethod = new GetMethod (uri);
>
> 
>
> 7. To execute this method:
>
> 
>
>             getMethod.execute (httpState, httpConnection);
>
> 
>
> Regards,
>
> Lalit
>


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org





Mime
View raw message