Page 1 of 1

Connection timeouts

Posted: Fri Feb 12, 2010 6:33 pm
by sijomon
Hi,

I have a problem when attempting to connect to an extrernal web application from within an Author Operation. The external web app can take several minutes to return a result, and therefore I have set the readTimeout and connectionTimeout to be 10 minutes. Unfortunately my timeout values seem to be being ignored at some point in the connection stack as I get read timeout execptions after about 30s.

My suspicion is that the Oxygen connection classes are ignoring my timeout values; can you clarify whetever this is liekly to be happening?

An example of my connection code is:

Code: Select all

hc = (HttpURLConnection) connection;
hc.setConnectTimeout(CONNECTION_TIMEOUT);
hc.setReadTimeout(CONNECTION_TIMEOUT);
responseCode = hc.getResponseCode(); < exzeption thrown here
the stack trace of the timeout exception is:

Code: Select all

rg.apache.commons.httpclient.HttpException: Read timed out (http://XXX.XXX.XXX.XXX:XXXX/validate/;jsessionid=EA83830A80ECBA4D915F76EDA0AC35F4?wicket:interface=:1:repeater:97:chunk::ILinkListener::)
at ro.sync.net.protocol.http.A.A(Unknown Source)
at ro.sync.net.protocol.http.A.A(Unknown Source)
at ro.sync.net.protocol.http.A.A(Unknown Source)
at ro.sync.net.protocol.http.WebdavHttpURLConnection.getInputStream(Unknown Source)
at ro.sync.net.protocol.http.WebdavHttpURLConnection.getResponseCode(Unknown Source)
at uk.co.smg.acm.oxygen.framework.cobra.OxygenRenderContext.submitFormSync(OxygenRenderContext.java:241)
at org.lobobrowser.html.test.SimpleHtmlRendererContext$1.run(SimpleHtmlRendererContext.java:249)
Feb 12, 2010 3:30:46 PM org.lobobrowser.html.test.SimpleHtmlRendererContext warn

Re: Connection timeouts

Posted: Fri Feb 12, 2010 6:42 pm
by Radu
Hello Simon,

Indeed Oxygen has its own implementation of HttpURLConnection so
creating an URL Connection like:

Code: Select all


new URL("http://www.oxygenxml.com").openConnection()
will return our own implementation.

Our implementation is not very compatible with the Java SUN implementation and only looks at the timeout set in the Oxygen
HTTP(S)/(S)FTP/Proxy Configuration / Advanced HTTP Settings
Preferences page.

We made some fixes to our URLConnection implementation to also use the setConnectionTimeout(), fixes which should be available in Oxygen 11.2.

In the meantime:
If you want to use the standard SUN HTTP URL Connection implementation you can use code like:

Code: Select all


sun.net.www.protocol.http.HttpURLConnection httpURLConnection = new 
sun.net.www.protocol.http.HttpURLConnection(new
URL("http://www.google.com"), null);
httpURLConnection.connect();
InputStream inputStream = httpURLConnection.getInputStream();
Regards,
Radu

Re: Connection timeouts

Posted: Fri Feb 12, 2010 7:29 pm
by sijomon
Thanks for the info. I think I'll just get the users to modify that property - 20s is a little short for the network here generally.

Thanks,

Simon.