Skip to content

Upgrade Apache HttpClient to version 4.0 [SPR-6180] #10848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spring-projects-issues opened this issue Oct 2, 2009 · 12 comments
Closed

Upgrade Apache HttpClient to version 4.0 [SPR-6180] #10848

spring-projects-issues opened this issue Oct 2, 2009 · 12 comments
Assignees
Labels
has: votes-jira Issues migrated from JIRA with more than 10 votes at the time of import in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Oct 2, 2009

Oleg Kalnichevski opened SPR-6180 and commented

Folks,

Please consider upgrading HttpClient to version 4.0 which is the latest stable (GA) version of the library. Commons HttpClient 3.1 is very likely to be deprecated / officially declared end of life very soon (3 - 6 months). There have been no bug fixes in the 3.x branch for over a year.

Patch attached. Unfortunately I was unable to fix the Ivy build which I am not very familiar with.

Oleg


Affects: 3.0 RC1

Attachments:

Issue Links:

Referenced from: commits 3690002, 54bbcf3

17 votes, 20 watchers

@spring-projects-issues
Copy link
Collaborator Author

Oleg Kalnichevski commented

RestTemplateIntegration tests pass for me when using HttpClient 4.0 based implementation of the HTTP request factory.

@spring-projects-issues
Copy link
Collaborator Author

Sylvain LAURENT commented

Any update on this ?

@spring-projects-issues
Copy link
Collaborator Author

Oleg Kalnichevski commented

Arjen, HttpClient 4.1 GA will be released within a week or two. Please consider upgrading to 4.1 bypassing 4.0.

Oleg

@spring-projects-issues
Copy link
Collaborator Author

Roy Clarkson commented

I've implemented Oleg's patch in Spring-Android-Rest-Template as HttpComponentsClientHttpRequestFactory, since Android has no support for the Commons 3.x client. ANDROID-7.

@spring-projects-issues
Copy link
Collaborator Author

John Eckhart commented

I understand adding 4.0 (or even better 4.1), but is there really a need to remove the 3.x support? This will require any project that has implemented HttpClient 3.x and CommonsClientHttpRequestFactory in their app to upgrade the entire HttpClient stack in order to upgrade from Spring 3.0.x to Spring 3.1. I believe that HttpClient 4.x occupies a separate package namespace (and maven group/artifact id) from HttpClient 3.x and the Spring factories for each have separate names. Perhaps it would be better to @deprecate CommonsClientHttpRequestFactory and mark it for removal at a later time?

@spring-projects-issues
Copy link
Collaborator Author

Arjen Poutsma commented

@John: we will do exactly that: deprecate the 3.x support in favor of 4.x support.

@spring-projects-issues
Copy link
Collaborator Author

Arjen Poutsma commented

This has been committed.

Oleg, thanks for the help! Could you please check SVN to see if everything is OK?

@spring-projects-issues
Copy link
Collaborator Author

Oleg Kalnichevski commented

Looks good to me. I wish there was a way to avoid having to buffer request content in memory, though.

Oleg

@spring-projects-issues
Copy link
Collaborator Author

David Parks commented

Not sure if I should comment here or open a new request, but I'll note here first: Any use cases which require an HttpContext attribute to be set aren't covered in this implementation, and the extensions required make the whole thing so messy as to make using the Rest Template more of a burden than a benefit. Here is the particular case that I've been fussing with today to little avail, setting preemptive authentication (i.e. send basic authentication headers by default rather than performing 2 requests to authenticate):

http://hc.apache.org/httpcomponents-client-ga/tutorial/html/authentication.html#d4e1023

The problem being that the RestTemplate implementation as it is has no support for setting HttpContext parameters (the template calls the Http.execute(HttpUriRequest) which uses only the non-accessible default HttpContext), there aren't any good way to set the default context parameters on the HttpClient in 4.x Apache HTTP Components. You end up needing to extend HttpClient to provide for default HttpContext params on the HttpClient object and the whole thing just becomes a spaghetti mess from there making the template more pain than pleasure.

@spring-projects-issues
Copy link
Collaborator Author

Arjen Poutsma commented

@David

That's certainly something we can try to improve. Can you please create a new JIRA for this issue, and comment the issue number here so that I can follow up on it?

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Jul 9, 2013

Arjen Poutsma commented

I wish there was a way to avoid having to buffer request content in memory, though.

There now is, see #15356.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has: votes-jira Issues migrated from JIRA with more than 10 votes at the time of import in: web Issues in web modules (web, webmvc, webflux, websocket) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants