What should I know about the trade-offs between these two HTTP libraries?
Asked
Active
Viewed 1,750 times
7
-
See [What is the best Java library to use for HTTP POST, GET etc.?](http://stackoverflow.com/questions/1322335/what-is-the-best-java-library-to-use-for-http-post-get-etc) – Matthew Flaschen Jun 09 '10 at 05:34
-
2close-voters, this is not an exact duplicate of the question you referenced. The other OP asked for `the best` HTTP lib, this one for a decision aid on two specific libs. – Andreas Dolk Jun 09 '10 at 06:21
2 Answers
4
Depends on your needs I would say. I used the java.net one while doing simple GETs and POSTs. Suddenly I needed support for session cookies etc, and I switched to the HTTPClient.
That's also my general recommendation. Don't introduces dependencies on third-party libraries for simple tasks that can be easily done without.

aioobe
- 413,195
- 112
- 811
- 826
1
Well, the apache library is easy to use and reliable, but as aioobe said introduces external dependencies (given that has apache license that should not be a problem for commercial products). IMHO if you have to handle a lot of simultaneous connections I will go for the apache lib as the performance will be probably better.
Check this article: http://lassewesth.blogspot.com.es/2009/05/i-like-apache-http-client-over.html

PakitoV
- 2,476
- 25
- 34