On Mon, Apr 23, 2012 at 02:40:08AM +0530, Kishanthan Thangarajah wrote:
> Hi Oleg,
> 
> On Sun, Apr 22, 2012 at 5:45 PM, Oleg Kalnichevski <[email protected]> wrote:
> 
> > On Sun, 2012-04-22 at 16:09 +0530, Kishanthan Thangarajah wrote:
> > > Hi All,
> > > We are in the process of supporting httpclient4 in axis2 [1] along with
> > > httpclient3 implementation. Since most of the httpclient4 implementations
> > > are new from 3, we have some questions on proceeding with it. With
> > > httpcleint 3, we used RequestEntity class in creating a Request entity
> > > which will be used in wrapping the axis2 message object. Then this will
> > be
> > > used by axis2 http sender in every request. With httpclient4, in getting
> > > the same thing done, we are using HttpEntity.
> > > But with HttpEntity, we have to implement getContent() method in getting
> > > the request entity content. This method returns an InputStream. So what
> > we
> > > did was, return a ByteArrayInputStream of the message in the method impl.
> > > (ie *return new ByteArrayInputStream(message.getBytes()*). But is this
> > the
> > > best way of handling this, method considering performance.?
> > > We figured out this way by referring to some of the available impl of
> > this
> > > method, such as in ByteArrayEntity etc.
> > >
> > > Thanks,
> > > Kishanthan.
> > >
> > > [1] https://issues.apache.org/jira/browse/AXIS2-4318
> >
> > Kishanthan
> >
> > The HttpEntity interface is used to represent content body of both
> > incoming and outgoing messages. As far as HTTP request messages on the
> > client side are concerned only #writeTo method is actually used when
> > writing the request content out to the underlying connection. One should
> > provide the #getContent method for the sake of completeness but the
> > implementation of this method will have no impact on performance of the
> > Axis2 HTTP transport.
> >
> > Hope this helps
> >
> 
> Thanks for the reply. Yes, it does help. FYI this[1] is the
> current implementation, where the method getRequestEntityContent() is
> called in the getContent() method of our HttpEntity impl.
> 

Looks reasonable to me.`


> I have some more questions.
> We used the following code segment in setting a default timeout for
> connection manager in httpclient3.
> *httpClient.getParams().setConnectionManagerTimeout(**connectionTimeoutValue
> **). *How can i do the same with httpclient4.?
> I have gone through the tutorial and found that we can set timeouts for
> httpclient or httpmethods by setting a parameter as
> *httpClient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT,
> connectionTimeoutValue). *But does this set the timeout for connection
> manager as-well?
> 

Yes, it does. As of version 4.1 HttpClient uses connect timeout value for 
connection lease requests.


> In httpclient3, when setting proxy credentials we used
> *httpClient.getState().setProxyCredentials(AuthScope.ANY,
> proxyCredentials). *So to do the same in 4, if i call
> *httpClient.getCredentialsProvider().setCredentials(AuthScope.ANY,
> proxyCredentials), *will it be ok.?.

It should be OK.


 Also can this way be used in setting
> other credentials (NTCredentials or UsernamePasswordCredentials) as-well ?
> 

Yes, it can.


> Also i found that most of the parameters are set or get using the
> respective methods in 3. But the same can be done by calling only the
> setParameter and providing the correct constants such
> as CoreConnectionPNames, ClientPNames, etc.
> 

There static convenience methods as well as HTTP parameter beans that can be 
used to get / set HTTP parameters [1]

HttpClient configuration is the single most complained about aspect of the 4.x 
API. I wish we had done it differently. I am considering investing some effort 
into trying to fix the problem in the 4.3 release series.

Oleg

[1] 
http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fundamentals.html#d5e339


> Thanks,
> Kishanthan.
> [1]
> http://svn.apache.org/viewvc/axis/axis2/java/core/branches/AXIS2-4318/modules/transport/http/src/org/apache/axis2/transport/http/AxisRequestEntity.java?revision=1327468&view=markup&pathrev=1327468
> 
> 
> >
> > Oleg
> >
> >
> > ---------------------------------------------------------------------
> > 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]

Reply via email to