Two Laptop Bag
The moose likes Sockets and Internet Protocols and the fly likes setting timeout for HTTP Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Reply Bookmark "setting timeout for HTTP" Watch "setting timeout for HTTP" New topic
Author

setting timeout for HTTP

Jeremy Thornton
Ranch Hand

Joined: Feb 21, 2002
Posts: 91
I'd like to set a timeout on an HTTP connection but there doesn't appear to be any way to do this cleanly.
Java 1.4 introduced timeouts on Sockets, but HttpUrlConnection doesn't appear to give access to the underlying socket.
I know there's a third party HttpClient that supports timeouts (and an unsupported system propery) but I'd prefer a core java solution.
Any ideas?
Cheers,
Jeremy.
Jeremy Thornton
Ranch Hand

Joined: Feb 21, 2002
Posts: 91
Decided to go for a combination of platform specific secret hidden sun property for some VMs together with a slow third party solution for remaining VMs.
Doesn't seem very satisfactory though. Apparently the lack of timeout is being addressed in 1.5. We'll see.
Sean Sullivan
Ranch Hand

Joined: Sep 09, 2001
Posts: 427
Use the Jakarta HttpClient library
http://jakarta.apache.org/commons/httpclient/
 
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: setting timeout for HTTP
 
Similar Threads
Error inserting data into database after few successfull insert.
Axis2: Timeout when using setUseSeparateListener(true)
Http timeout java 1.4.2
Session time out in JSF
How to specify WebService operation timeout