Should I use the java.net or org.apache.http library for HTTP in my Java application?
What should I know about the trade-offs between these two HT开发者_如何转开发TP libraries?
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.
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
精彩评论