Re: [POLL] Minimal JRE level as of HttpClient 4.4

2013-09-16 Thread Jordi Domingo Borràs
---

> [ ] keep Java 1.5 compatibility: no good reason to upgrade.
> [ ] upgrade to Java 1.6: one step at a time.
> [X] upgrade to Java 1.7: new features are more important.
> ---
>


Parsing Invalid HTTP Headers

2012-10-31 Thread Jordi Domingo Borràs
Hi,

I'm getting this error due to an invalid header.

I'm using Http 4.2.2 with a PoolingClientConnectionManager and what is
explained here:
http://hc.apache.org/httpcomponents-client-ga/tutorial/html/advanced.html#d5e1339
doesn't
work.

I've also tried with a Response Interceptor but fails before calling it.

Below is the stacktrace. Any help is greatly appreciated.

Caused by: org.apache.http.ProtocolException: Invalid header: Expires
 at
org.apache.http.impl.io.AbstractMessageParser.parseHeaders(AbstractMessageParser.java:226)
~[httpcore-4.2.2.jar:4.2.2]
at
org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:261)
~[httpcore-4.2.2.jar:4.2.2]
 at
org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:289)
~[httpcore-4.2.2.jar:4.2.2]
at
org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:252)
~[httpclient-4.2.2.jar:4.2.2]
 at
org.apache.http.impl.conn.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:191)
~[httpclient-4.2.2.jar:4.2.2]
at
org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:300)
~[httpcore-4.2.2.jar:4.2.2]
 at
org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:127)
~[httpcore-4.2.2.jar:4.2.2]
at
org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:712)
~[httpclient-4.2.2.jar:4.2.2]
 at
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:517)
~[httpclient-4.2.2.jar:4.2.2]
at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
~[httpclient-4.2.2.jar:4.2.2]
 ... 7 common frames omitted

Regards,

Jordi


Re: ConnectTimeoutException after 5 to 6 hrs

2011-10-25 Thread Jordi Domingo Borràs
Hi Litty,

You can do:

EntityUtils.consume(entity);

Regards,

Jordi

On Tue, Oct 25, 2011 at 11:07, Litty Preeth  wrote:

> I posted the same issue on stackoverflow:
>
> http://stackoverflow.com/questions/7723558/apache-httpclient-giving-connection-timeout-after-5-ot-6-hrs
>
> Someone suggested that I these issue comes if the response is not fully
> emptied. Also if I enable the wire and header debug for httpclient, I am
> not
> getting this issue. So may be the root cause is because the response is not
> fully drained. I tried the following for every request:
>
> int statusCode = res.getStatusLine().getStatusCode();
> String reasonPhrase = res.getStatusLine().getReasonPhrase();
> Header[] headers = res.getAllHeaders();
> HashMap headerMap = new HashMap();
> if (headers != null) {
>for (Header header : headers) {
>if (header != null) {
>headerMap.put(header.getName(), header.getValue());
>}
>}
> }
> HttpEntity resEntity = res.getEntity();
> if (resEntity != null && resEntity.getContentLength() > 0) {
>ByteArrayOutputStream os = new ByteArrayOutputStream();
>resEntity.writeTo(os);
>resStr = os.toString();
> }
>
> But I am still getting the issue if I don't turn on debug logging. So can
> anybody suggest how to empty a response?
>
> Regards,
> Litty Preeth
>
> On Thu, Oct 20, 2011 at 1:47 AM, Vasile Alin  >wrote:
>
> > On 18 October 2011 08:05, Litty  wrote:
> >
> > > I am able to connect to the same URL from the same machine using a
> > browser.
> > > So I don't think the issue is with web server.
> > >
> >
> > This doesn't prove that there are no issues with the web server.
> >
> > -
> > To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
> > For additional commands, e-mail: httpclient-users-h...@hc.apache.org
> >
> >
>


Setting up a delay between requests to a host

2011-10-14 Thread Jordi Domingo Borràs
Hi all,

I'm using the latest version of HttpClient.

I've set it up with ccm.setDefaultMaxPerRoute(1)  but I also need to
establish a delay between requests for some hosts.

Is there any fast way to do so? If not, your suggestions are greatly
appreciated.


thanks a lot!

Jordi


Corrupt GZIP trailer

2011-07-19 Thread Jordi Domingo Borràs
Hi!

Im getting this exception, when i try to load this resource
http://www.gogvo.com/evp/video/52342/Allianz--Optimaxx-Plus

java.io.IOException: Corrupt GZIP trailer
at java.util.zip.GZIPInputStream.readTrailer(GZIPInputStream.java:182)
at java.util.zip.GZIPInputStream.read(GZIPInputStream.java:94)
at java.io.FilterInputStream.read(FilterInputStream.java:90)
at
org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:155)
at com.blueliv.common.io.FileUtils.copy(FileUtils.java:218)
at com.blueliv.common.io.FileUtils.copy(FileUtils.java:236)
at com.blueliv.optos.services.UrlCache.loadUrl(UrlCache.java:732)


It can be viewed in the browser without problems. I dont know if theres
something i can do.

Thanks a lot,

Jordi


Re: Connection pool timeout

2011-04-30 Thread Jordi Domingo Borràs
Thanks a lot Oleg!! Thanks :)

On Sat, Apr 30, 2011 at 13:21, Oleg Kalnichevski  wrote:

> On Thu, 2011-04-28 at 17:25 +0200, Jordi Domingo Borràs wrote:
> > Hi Oleg,
> >
> > It would be great to have another parameter. This is really useful for
> me,
> > I'm sorry if my english is not as good as it should be
> > in order to explain it better.
> >
> > I need to load a lot of url's. I need to load them whenever connections
> from
> > pool are  available, it doesnt matter if its now or in 10 minutes. -->
> > TIMEOUT value infinite
> > I dont want to block a connection more than 10 seconds waiting for a
> > response from server. TIMEOUT value 10 seconds
> >
> >
> > Thanks again Oleg,
> >
> > Jordi
> >
>
> Jordi
>
> You can now set a timeout for connection manager operations with
>
> ConnManagerParams#setTimeout() when using the latest snapshot off the
> 4.1.x branch or
>
> HttpClientParams#setConnectionManagerTimeout() when using the latest
> snapshot off the trunk (4.2)
>
> Oleg
>
>
>
>
> -
> To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
> For additional commands, e-mail: httpclient-users-h...@hc.apache.org
>
>


Re: Connection pool timeout

2011-04-28 Thread Jordi Domingo Borràs
Hi Oleg,

It would be great to have another parameter. This is really useful for me,
I'm sorry if my english is not as good as it should be
in order to explain it better.

I need to load a lot of url's. I need to load them whenever connections from
pool are  available, it doesnt matter if its now or in 10 minutes. -->
TIMEOUT value infinite
I dont want to block a connection more than 10 seconds waiting for a
response from server. TIMEOUT value 10 seconds


Thanks again Oleg,

Jordi


On Thu, Apr 28, 2011 at 17:09, Oleg Kalnichevski  wrote:

> On Thu, 2011-04-28 at 16:10 +0200, Jordi Domingo Borràs wrote:
> > Im using a ThreadSafeClientConnManager with a max total of 50. If all of
> > them are busy,
> > waiting resources will timeout and I dont want this.
> >
> > On the other side, if a timeout waiting for a connection to be
> established
> > occurs, I will
> > retry twice and then assume site is down.
> >
> > I dont care if a connection is served from the pool or is new.
> >
> > Thanks,
> > Jordi
> >
> >
>
> I am not sure I fully understand why this is useful, but I can
> re-introduce a separate parameter for connection manager timeout, if
> necessary.
>
> Oleg
>
>
>
> -
> To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
> For additional commands, e-mail: httpclient-users-h...@hc.apache.org
>
>


Re: Connection pool timeout

2011-04-28 Thread Jordi Domingo Borràs
Im using a ThreadSafeClientConnManager with a max total of 50. If all of
them are busy,
waiting resources will timeout and I dont want this.

On the other side, if a timeout waiting for a connection to be established
occurs, I will
retry twice and then assume site is down.

I dont care if a connection is served from the pool or is new.

Thanks,
Jordi


On Thu, Apr 28, 2011 at 15:32, Oleg Kalnichevski  wrote:

> On Thu, 2011-04-28 at 12:32 +0200, Jordi Domingo Borràs wrote:
> > Hi Oleg,
> >
> > I need an infinite timeout waiting for a connection from the pool ( i
> need
> > the resource to load, whenever possible, doesnt matter if its now or in 5
> > min).
> > I need a low value timeout when connecting to a host.
> >
>
> But why? Why do you care if a connection has been served from the pool
> or newly created? In both cases one simply needs to ensure that I/O
> threads do not get blocked indefinitely while waiting for a connection
> to be established.
>
> Oleg
>
>
>
> -
> To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
> For additional commands, e-mail: httpclient-users-h...@hc.apache.org
>
>


Re: Connection pool timeout

2011-04-28 Thread Jordi Domingo Borràs
Hi Oleg,

I need an infinite timeout waiting for a connection from the pool ( i need
the resource to load, whenever possible, doesnt matter if its now or in 5
min).
I need a low value timeout when connecting to a host.

Now when a connection pool timeout occurs I queue it again but i'm not happy
with this.

I think that increasing the pool size will not be good for my BW.

Thanks,
Jordi

On Wed, Apr 27, 2011 at 21:51, Oleg Kalnichevski  wrote:

> On Wed, 2011-04-27 at 17:51 +0200, Jordi Domingo Borràs wrote:
> > Hi :)
> >
> > Is there a way to specify a TIMEOUT value for connections to other hosts
> and
> > another TIMEOUT for waiting a free connection from the pool?
> >
>
> Not any more. What are the reasons you would like to use different
> timeout values for these two operations?
>
> Oleg
>
>
>
> -
> To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
> For additional commands, e-mail: httpclient-users-h...@hc.apache.org
>
>


Connection pool timeout

2011-04-27 Thread Jordi Domingo Borràs
Hi :)

Is there a way to specify a TIMEOUT value for connections to other hosts and
another TIMEOUT for waiting a free connection from the pool?

I found in previous versions ConnManagerPNames.TIMEOUT and
CoreConnectionPNames.
CONNECTION_TIMEOUT but now theres only
CoreConnectionPNames.CONNECTION_TIMEOUT.

Thanks in advance.