Pavel Bucek's Weblog

  • April 20, 2011

Jersey Client - Apache HTTP Client 4.x integration

Since this week, Jersey users can benefit from Apache HTTP Client 4.x
integration. "jersey-apache-http-client4" module has been finalized and
provides similar functionality as "jersey-apache-http-client", but make
sure you read javadoc - most of settings have changes because of major
change in Apache HTTP Client API.

How to start with Jersey and Apache HTTP Client 4.x?

Add following dependency:

    <version>1.7-SNAPSHOT</version> <!-- or 1.7-ea04 and newer, when available -->

And you can instantiate new client for example like described in Javadoc: package com.sun.jersey.client.apache4.

Join the discussion

Comments ( 6 )
  • guest Wednesday, June 8, 2011
    Thanks for the update, now its possible to use the client4 features like (HTTP) caching which is a good performance boost. The issue that I'm having is that the 1.7 impl. does not support HTTPS (or at least I cannot get it to work). It seems that the getHost() method in ApacheHttpClient4Handler does not take the scheme into account thus always creating an HttpHost using HTTP.
    Best Regards,
  • Pavel Wednesday, June 8, 2011
    Yeah, you are right. Fixed in the trunk, updated version will be available on Friday (1.8-ea03) and in all future releases (1.8 should be released in late June). Thanks for report and for the evaluation!
  • guest Wednesday, May 23, 2012

    I am trying to figure out how to submit a problem report for jersey-client-apache4. When we switched our Discovery Services SALs to use the jersey-client-apache4, we found that the client.setReadTimeout() method didn't have any apparent effect. Can you assist in getting this reported to Jersey?

  • Pavel Wednesday, May 23, 2012

    You can use users@jersey.java.net mailing list or file new issue in Jersey JIRA: http://java.net/jira/browse/JERSEY. Thanks!

  • guest Tuesday, September 25, 2012

    I'm also facing the same problem -client.setReadTimeout() does not seem to be working with Apache4.

  • Satyam Monday, May 6, 2013

    Iam also facing the similar problem after porting to jersey-apache4.

    Connect Timeout and Read Timeout not working.

    Appriciate for any help.

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.