aspose file tools
The moose likes Sockets and Internet Protocols and the fly likes UrlConnections versus HttpURLConnection versus Apaches HttpClient Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Reply Bookmark "UrlConnections versus HttpURLConnection versus Apaches HttpClient " Watch "UrlConnections versus HttpURLConnection versus Apaches HttpClient " New topic
Author

UrlConnections versus HttpURLConnection versus Apaches HttpClient

Cindy Jones
Ranch Hand

Joined: Oct 08, 2002
Posts: 66
I need to send a get request to a secure url and process the response.
The options that I have are java.net.UrlConnection, java.net.HttpUrlConnection and org.apache.commons.httpclient.HttpClient. What would be the best choice?

Thanks!
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8291

URLConnection is abstract. Most any URLConnection is actually an instance of HttpURLConnection. So that's one down.
I've had good results with both HttpClient and URLConnection. HttpClient makes it easy to manage cookies so if you have to maintain a session I'd go with it.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Cindy Jones
Ranch Hand

Joined: Oct 08, 2002
Posts: 66
Thanks!
Schandha Ravi
Ranch Hand

Joined: Oct 20, 2007
Posts: 167
Hi,

Can't we use servlet to post the request here? Do we need to use URLConnection for sending the data over a secured connection.

Thanks
Ravi


Thanks & Regards, SK
SCJP 5.0, DB2 - 800, DB2 - 803, SCDJWS (On the way)
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959


Can't we use servlet to post the request here?

You can't use a servlet to send a request. Servlet can only receive a request and send a response.


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Schandha Ravi
Ranch Hand

Joined: Oct 20, 2007
Posts: 167
How foolish Am I . I haven't even read the question properly. Anyways thanks for clarification.

Thanks
Ravi
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: UrlConnections versus HttpURLConnection versus Apaches HttpClient
 
Similar Threads
Interview Tips
connection object
Swing Components
Is there any collection to store the premitive data type?
Googlefight!