Should I use java.net or org.apache.http library for HTTP in my Java application?

What do I know about the trade-offs between these two HTTP libraries?

+6
java apache networking
source share
2 answers

Depending on your needs, I would say. I used java.net when doing simple GET and POST. Suddenly I need support for session cookies, etc., and I switched to HTTPClient.

This is also my general recommendation. Do not introduce dependencies on third-party libraries for simple tasks that can be easily completed without them.

+3
source

Well, the apache library is easy to use and reliable, but as aioobe said, it introduces external dependencies (given that it has an apache license, which should not be a problem for commercial products). IMHO, if you have to handle many concurrent connections, I will go to apache lib, as the performance will probably be better.

Check out this article: http://lassewesth.blogspot.com.es/2009/05/i-like-apache-http-client-over.html

0
source

All Articles