hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Upgrading from Httpclient 3.1 to 4.5 - localhost:443 not responding
Date Sat, 22 Apr 2017 16:26:06 GMT
On Fri, 2017-04-21 at 10:21 -0400, Hassan Khan wrote:
> Hi all,
> 
>   We have pinpointed the issue and looks like the code that deals
> with
> streaming a object from the client to the server.
>   With the old code (Httpclient 3.1) we would stream the object
> through a
> ObjectOutputStream and on the server side read it through a
> ObjectInputStream.
>   But looks like that workflow is not working in the new httpclient
> 4.5.
>   Is there any example or resource that specifically shows how
> streaming
> objects work ?
> 

See this section of the tutorial

http://hc.apache.org/httpcomponents-client-4.5.x/tutorial/html/fundamen
tals.html#d5e95


What you most likely want is SerializableEntity

http://hc.apache.org/httpcomponents-core-4.4.x/httpcore/apidocs/org/apa
che/http/entity/SerializableEntity.html

Oleg


> Thanks
> Hassan
> 
> On Tue, Apr 18, 2017 at 9:27 AM, Hassan Khan <hassankhan986@gmail.com
> >
> wrote:
> 
> > Hi ,
> > 
> > Sorry the log images was filtered out. you can look at the uploaded
> > image.
> > 
> > http://imgur.com/a/Nxpcw
> > 
> > in text the logs say: I/O read timed out.
> > 
> > Thanks
> > Hassan
> > 
> > On Mon, Apr 17, 2017 at 1:35 PM, Gary Gregory <garydgregory@gmail.c
> > om>
> > wrote:
> > 
> > > Hassan,
> > > 
> > > Your attachments were filtered out. You might want to try an
> > > image sharing
> > > site.
> > > 
> > > Gary
> > > 
> > > On Mon, Apr 17, 2017 at 6:16 AM, Hassan Khan <hassankhan986@gmail
> > > .com>
> > > wrote:
> > > 
> > > > +
> > > > > 
> > > > 
> > > > 
> > > > > Hi All,
> > > > > 
> > > > > 
> > > > > 
> > > > >    We are upgrading the httpclient in our software from 3.1
> > > > > to 4.5 (we
> > > > > are adding both core and client). But we are having some
> > > > > issues in the
> > > > > client and server communications. We are using the below
> > > > > client code
> > > > > (simplified the code ) to make a  call every 60 secs and we
> > > > > are getting
> > > > > localhost not responding after few tries.
> > > > > 
> > > > > Client code simplified is :
> > > > > 
> > > > > RequestConfig config = RequestConfig.*custom*()
> > > > > 
> > > > >               .setConnectTimeout(20 * 1000)
> > > > > 
> > > > >               .setConnectionRequestTimeout(10* 60 *
1000)
> > > > > 
> > > > >               .*setStaleConnectionCheckEnabled**(**true**)*
> > > > > 
> > > > >               .setSocketTimeout(10 * 60 * 1000).build();
> > > > > 
> > > > > *this*.client =
> > > > > HttpClients.*custom*().setDefaultRequestConfig(config
> > > > > ).build();
> > > > > 
> > > > > HttpResponse response = client.execute(postMethod);
> > > > > 
> > > > > *int* rc = response.getStatusLine().getStatusCode();
> > > > > 
> > > > > *if* (rc > 200) {
> > > > > 
> > > > >       log error
> > > > > 
> > > > > }
> > > > > 
> > > > > //using the object stream to read data..
> > > > > 
> > > > > ois = *new*
> > > > > ObjectInputStream(response.getEntity().getContent());
> > > > > 
> > > > > //at the end we close it
> > > > > 
> > > > > postMethod.releaseConnection();
> > > > > 
> > > > > 
> > > > > 
> > > > > But still we are getting the following issue:
> > > > > 
> > > > > 
> > > > > [image: cid:image003.png@01D2B446.A78B7290]
> > > > > 
> > > > > 
> > > > > 
> > > > > Any recommendations would be appreciated. we have 2 thread
> > > > > making a
> > > > > request every 60 secs. When we used a spooling manager always
> > > > > one
> > > 
> > > route was
> > > > > used..
> > > > > 
> > > > 
> > > >     May be both thread that are calling the same URL
> > > > simultaneously are
> > > > sharing one connection , but they should share different
> > > > connections..
> > > > 
> > > > > 
> > > > > 
> > > > > Thanks
> > > > > 
> > > > > 
> > > > > 
> > > > > *Hassan Khan*
> > > > > 
> > > > > Software Developer
> > > > > 
> > > > > 
> > > > 
> > > > 
> > > > 
> > > 
> > > 
> > > --
> > > E-Mail: garydgregory@gmail.com | ggregory@apache.org
> > > Java Persistence with Hibernate, Second Edition
> > > <https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?
> > > ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&link
> > > Code=as2&tag=garygregory-
> > > 20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8>
> > > 
> > > <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=
> > > am2&o=1&a=1617290459>
> > > JUnit in Action, Second Edition
> > > <https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?
> > > ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&link
> > > Code=as2&tag=garygregory-
> > > 20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22>
> > > 
> > > <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=
> > > am2&o=1&a=1935182021>
> > > Spring Batch in Action
> > > <https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?
> > > ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&link
> > > Code=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Bli
> > > nk_id%7D%7D%22%3ESpring+Batch+in+Action>
> > > <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=
> > > am2&o=1&a=1935182951>
> > > Blog: http://garygregory.wordpress.com
> > > Home: http://garygregory.com/
> > > Tweet! http://twitter.com/GaryGregory
> > > 
> > 
> > 
> > 
> > --
> > Hassan Khan
> > 
> 
> 
> 

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


Mime
View raw message