- Timestamp:
- 2009-04-28T20:47:13+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r1559 r1563 367 367 addAuth(activeConnection); 368 368 369 if (request Body != null) {369 if (requestMethod.equals("PUT") || requestMethod.equals("POST")) { 370 370 activeConnection.setDoOutput(true); 371 activeConnection.setRequestProperty("Content-type", "text/xml"); 371 372 OutputStream out = activeConnection.getOutputStream(); 372 BufferedWriter bwr = new BufferedWriter(new OutputStreamWriter(out, "UTF-8")); 373 bwr.write(requestBody); 374 bwr.flush(); 375 out.close(); 376 } else { 373 377 374 // It seems that certain bits of the Ruby API are very unhappy upon 378 375 // receipt of a PUT/POST message withtout a Content-length header, 379 376 // even if the request has no payload. 380 377 // Since Java will not generate a Content-length header unless 381 // we use the output stream, we create one and write no data to 382 // it, instead of not creating one. -- fr 6-Apr-09 383 activeConnection.setDoOutput(true); 384 OutputStream out = activeConnection.getOutputStream(); 378 // we use the output stream, we create an output stream for PUT/POST 379 // even if there is no payload. 380 if (requestBody != null) { 381 BufferedWriter bwr = new BufferedWriter(new OutputStreamWriter(out, "UTF-8")); 382 bwr.write(requestBody); 383 bwr.flush(); 384 } 385 385 out.close(); 386 386 }
Note:
See TracChangeset
for help on using the changeset viewer.