Handle the output even on non-HttpURLConnection. Set the method later than enabling output, as on phones the enablement of output may change the output method
1.1 --- a/ko-ws-tyrus/src/main/java/org/netbeans/html/wstyrus/LoadJSON.java Wed Feb 05 13:10:26 2014 +0100
1.2 +++ b/ko-ws-tyrus/src/main/java/org/netbeans/html/wstyrus/LoadJSON.java Wed Feb 05 13:11:35 2014 +0100
1.3 @@ -109,17 +109,16 @@
1.4 try {
1.5 final URL u = new URL(base, url.replace(" ", "%20"));
1.6 URLConnection conn = u.openConnection();
1.7 - if (conn instanceof HttpURLConnection) {
1.8 - HttpURLConnection huc = (HttpURLConnection) conn;
1.9 - if (call.getMethod() != null) {
1.10 - huc.setRequestMethod(call.getMethod());
1.11 - }
1.12 - if (call.isDoOutput()) {
1.13 - huc.setDoOutput(true);
1.14 - final OutputStream os = huc.getOutputStream();
1.15 - call.writeData(os);
1.16 - os.flush();
1.17 - }
1.18 + if (call.isDoOutput()) {
1.19 + conn.setDoOutput(true);
1.20 + }
1.21 + if (call.getMethod() != null && conn instanceof HttpURLConnection) {
1.22 + ((HttpURLConnection) conn).setRequestMethod(call.getMethod());
1.23 + }
1.24 + if (call.isDoOutput()) {
1.25 + final OutputStream os = conn.getOutputStream();
1.26 + call.writeData(os);
1.27 + os.flush();
1.28 }
1.29 final PushbackInputStream is = new PushbackInputStream(
1.30 conn.getInputStream(), 1