Lalit Sahoo wrote:
Hi Oleg,
Could you please explain in little detail how HttpClient is related to SSL tunneling,redirect and authentication?
HttpClient uses a package private class called HttpMethodDirector to
take care of the SSL tunneling, redirect handling and authentication. If
you do not use HttpClient to execute requests you lose all that
functionality. I hope this is detailed enough
Oleg
Regards,
Lalit
________________________________
From: Oleg Kalnichevski [mailto:[EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
------------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]