Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7739017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:24:55+00:00 2026-06-01T08:24:55+00:00

So, I’ve come to the conclusion that Apache HttpComponents 4 is one of the

  • 0

So, I’ve come to the conclusion that Apache HttpComponents 4 is one of the most overwrought APIs I’ve ever come across. Things that seem like they should be simple are taking hundreds of lines of code (and I’m still not sure resources get cleaned up correctly).

Plus it wants me to do things like:

List<NameValuePair> qparams = new ArrayList<NameValuePair>();
qparams.add(new BasicNameValuePair("q", "httpclient"));
qparams.add(new BasicNameValuePair("btnG", "Google Search"));
qparams.add(new BasicNameValuePair("aq", "f"));
qparams.add(new BasicNameValuePair("oq", null));
URI uri = URIUtils.createURI("http", "www.google.com", -1, "/search", 
  URLEncodedUtils.format(qparams, "UTF-8"), null);

Which, just… no. I know it’s Java, and we’re not into the whole brevity thing, but that’s a little much. Not to mention the jars are up to 700KB.

Anyway, enough ranting, I wanted to see what kind of experiences people have had with other HTTP client libraries?

The ones I’m aware of are: Jetty, hotpotato, and AsyncHttpClient.

This is for server-side use, I’m mostly interested in performance for many concurrent gets and large file transfers.

Any recommendations?

PS I know the venerable HttpClient 3.1 is still there, but I’d like to use something that’s supported.

Update

@oleg: this is what the docs suggest:

    HttpClient httpclient = new DefaultHttpClient();
    try {
        HttpGet httpget = new HttpGet("http://www.apache.org/");
        HttpResponse response = httpclient.execute(httpget);
        HttpEntity entity = response.getEntity();
        if (entity != null) {
            InputStream instream = entity.getContent();
            try {
                instream.read();
            } catch (IOException ex) {
                throw ex;
            } catch (RuntimeException ex) {
                httpget.abort();
                throw ex;
            } finally {
                try { instream.close(); } catch (Exception ignore) {}
            }
        }
    } finally {
        httpclient.getConnectionManager().shutdown();
    }

I still get unexpected errors when consuming entity content when using ThreadSafeClientConnManager. I’m sure it’s my fault, but at this point I don’t really want to have to figure it out.

Hey, I don’t mean to disparage anyone’s work here, but I’ve been making a good-faith effort to use HttpComponents since 4.0 came out and it’s just not working for me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T08:24:56+00:00Added an answer on June 1, 2026 at 8:24 am

    Answering my own question since this got resurrected for some reason.

    I ended up writing a few simple wrappers around java.net.HttpURLConnection, seems it’s come a long way since the last time I seriously considered it.

    Apache HttpComponents is great, but can be overkill for simple tasks. Also, at least in my scenario, HUC is noticeably faster (mostly single-threaded, haven’t done any testing under heavy load).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.