Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

setting timeout for HTTP  RSS feed

 
Jeremy Thornton
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 427
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the Jakarta HttpClient library
http://jakarta.apache.org/commons/httpclient/
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!