Page 1 of 1

WebdavHttpURLConnection vs HttpURLConnection

Posted: Mon Sep 14, 2015 10:51 am
by sebastienlavandier
Hello,

I am currently developing an Oxygen Author CMS plugin, and I use web services to communicate with the CMS.
More precisely, I use "Spring Rest Template client" for communicate with the CMS.
And I have some strange behavior with this web services...

For example, I implemented a unit test for use the retrieveFunction() method that retrieve me a Function object (Function.class) from the CMS.
I receive a json response that represent a function object.
So the unit test work well.

But when I use the same method (retrieveFunction()) from Oxygen Author CMS plugin, the web service send me an xml response... Of course, in the method we have the same headers, parameters, ...

I find a difference when Spring rest template instantiate a connection
HttpURLConnection connection = openConnection(uri.toURL(), this.proxy);

Unit Test : => sun.net.www.protocol.http.HttpURLConnection
From CMS : => ro.sync.net.protocol.http.WebdavHttpURLConnection

I have find others problems like that, for example with an other WS that retrieve me a list of function object, that can't be parse to a list of object (but in JSON format in this case !).

So, How I can use HttpURLConnection by default ? or If you have an other idea...

Thanks in advance for your help.
Sébastien.L

Re: WebdavHttpURLConnection vs HttpURLConnection

Posted: Mon Sep 14, 2015 11:01 am
by Radu
Hi Sébastien,

Indeed when the Oxygen standalone is started, it registers its own HTTP(S) handlers based on the Apache Components HTTP Client.
And our implementation may not be 100% similar to the Oracle HTTP url connection implementation.
To workaround that you can create directly a sun.net.www.protocol.http.HttpURLConnection class and use it.
Of course you could also send us some sample Java code of how you are using the connection and we could investigate why our connection behaves differently in this case, possibly fix it.

Regards,
Radu