Non-persistent HttpURLConnections timeout with built-in server

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Non-persistent HttpURLConnections timeout with built-in server

Christian Bauer
Using the built-in HTTP server connector in Restlet 2.2.0, the following client code will run into a read timeout after one second. The server resource doesn't matter, even the most basic one will do.

        System.setProperty("http.keepAlive", "false");

        HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
        urlConnection.setReadTimeout(1000);
        System.out.println("Response: " + urlConnection.getResponseCode());

This is JDK 1.6.0_20 on OS X. If you enable persistent connections by commenting out the first line the request works fine. I've tested the Simple and the Jetty server connectors, they have no problem with a non-persistent HttpURLConnection.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

RE: Non-persistent HttpURLConnections timeout with built-in server

jlouvel
Administrator
Hi Christian,

This looks like a bug so I entered a report for tracking purpose:
http://restlet.tigris.org/issues/show_bug.cgi?id=1191

Best regards,
Jerome


-----Message d'origine-----
De : Christian Bauer [mailto:[hidden email]]
Envoyé : lundi 26 juillet 2010 14:36
À : [hidden email]
Objet : Non-persistent HttpURLConnections timeout with built-in server

Using the built-in HTTP server connector in Restlet 2.2.0, the following
client code will run into a read timeout after one second. The server
resource doesn't matter, even the most basic one will do.


        System.setProperty("http.keepAlive", "false");

        HttpURLConnection urlConnection = (HttpURLConnection)
url.openConnection();
        urlConnection.setReadTimeout(1000);
        System.out.println("Response: " + urlConnection.getResponseCode());


This is JDK 1.6.0_20 on OS X. If you enable persistent connections by
commenting out the first line the request works fine. I've tested the Simple
and the Jetty server connectors, they have no problem with a non-persistent
HttpURLConnection.

--
View this message in context:
http://restlet-discuss.1400322.n2.nabble.com/Non-persistent-HttpURLConnectio
ns-timeout-with-built-in-server-tp5337760p5337760.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=26382
51

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2668662
Loading...