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 8284815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:15:04+00:00 2026-06-08T11:15:04+00:00

I am using RestClient to connect to a remote JSON API. Previously, in Spring

  • 0

I am using RestClient to connect to a remote JSON API.
Previously, in Spring 3.0, I was using Commons HTTPClient.
I found that performance was low due to a lot of locking in the old multithreaded connection manager.

I now want to try Apache HttpComponents 4.2 since it appears they fixed up the locking.
I would like to use the PoolingClientConnectionManager as the constructor parameter for the DefaultHttpClient that will be autowired for the different classes.

The challenge is setting up the PoolingClientConnectionManager connection manager. I want a high number of concurrent connection to the JSON API provider. These use HttpRoute objects to represent the hostname. But, as described in http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/conn/PoolingClientConnectionManager.html, PoolingClientConnectionManager uses a setMaxPerRoute(HttpRoute, int maxConnections) method.

How can I set up the connection manager a Spring context.xml file, since it doesn’t use simple setters?

  • 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-08T11:15:06+00:00Added an answer on June 8, 2026 at 11:15 am

    How about wrapping the PoolingClientConnectionManager by extending it, and then creating setters using a Bean representing a route/max value. Ie.

    // Your bean
    public class RouteMax() {
      private HttpRoute httpRoute;
      private int max;
      ... setters/getters
    }
    
    // Extending the PoolingClientConnectionManager
    ...
    public class CustomPoolingClientConnectionManager extends PoolingClientConnectionManager {
    ...
    public setRouteMax(RouteMax routeMax) {
      super.setMaxPerRoute(routeMax.getHttpRoute(), routeMax.getMax());
    }
    

    ..then in your Spring config you can set the routeMax property using your RouteMax bean.

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

Sidebar

Related Questions

I have an API that expects/accepts in the body XML and can return json
I am trying to query an api through JSON / REST using Ruby. require
I need to test my REST API backend that accepts JSON with the Advanced
I'm using a firefox pluing called restclient to simulate a post request. It doesnt'
I'm looking to implement a REST client in PHP, and have previously been using
I am trying to send a JSON data to a Sinatra app by RestClient
I am using the Dropbox iOS API to sync between different devices. Using the
I have a method for reading JSON from a service, I'm using Gson to
I am making an ajax request using JQuery that looks like this: var data
I am writing some tests in Ruby using RestClient. The test is working fine

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.