• Post Reply Bookmark Topic Watch Topic
  • New Topic

HttpURLConnection

 
Vineet Venkatesh
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys!!
I am facing a problem wherein i have been unable to set the timeout parameter for HttpsUrlConnection. Please let me know if i can set the timeout parameter using the URLConnection class or the HttpUrlConnection or the HttpsUrlConnection (using the JSSE api's)
Any insight into the above stated problem would be highly appreciable
Thanks and Regards
Vineet Venkatesh
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Networking Properties guide lists the sun.net.client.defaultConnectTimeout and sun.net.client.defaultReadTimeout properties for URLConnection. This suggests they will also be used for its HttpsURLConnection subclass, but I was not able to confirm that. The JSSE Guide is silent on the matter.
- Peter
 
Vineet Venkatesh
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Peter,
Thanks for the insight ........... but i still am confused as to whether i can set the
" sun.net.client.defaultConnectTimeout " property specified in the NetWorking Guide properties and if so how and where do i do it to set the timeout properties for the HttpURLConnection. Do i need to set it as a system property?
Hope to hear soon from you.
Thanks and Regards
Vineet Venkatesh
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
-Dproperty=value on the java command line (one or more times), or System.setProperty(property, value) at initialisation time.
- Peter
 
shell Johnson
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is per JVM setting? can I set it per connection? Or I have to set it before I use it and reset it after I am done. This is inconvenience when I'm in the multiple thread environment and I'm changing the other HTTP connection behavior?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!