Changeset 17498 in josm
- Timestamp:
- 2021-02-20T22:03:24+01:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r17333 r17498 458 458 String ret = ""; 459 459 try { 460 ret = send Request("PUT","changeset/create", toXml(changeset), progressMonitor);460 ret = sendPutRequest("changeset/create", toXml(changeset), progressMonitor); 461 461 changeset.setId(Integer.parseInt(ret.trim())); 462 462 changeset.setOpen(true); … … 493 493 initialize(monitor); 494 494 monitor.setCustomText(tr("Updating changeset {0}...", changeset.getId())); 495 sendRequest( 496 "PUT", 497 "changeset/" + changeset.getId(), 498 toXml(changeset), 499 monitor 500 ); 495 sendPutRequest("changeset/" + changeset.getId(), toXml(changeset), monitor); 501 496 } catch (ChangesetClosedException e) { 502 497 e.setSource(ChangesetClosedException.Source.UPDATE_CHANGESET); … … 532 527 monitor.beginTask(tr("Closing changeset...")); 533 528 initialize(monitor); 534 /* send "\r\n" instead of empty string, so we don't send zero payload - works around bugs 535 in proxy software */ 536 sendRequest("PUT", "changeset" + "/" + changeset.getId() + "/close", "\r\n", monitor); 529 // send "\r\n" instead of empty string, so we don't send zero payload - workaround bugs in proxy software 530 sendPutRequest("changeset/" + changeset.getId() + "/close", "\r\n", monitor); 537 531 changeset.setOpen(false); 538 532 } finally { … … 571 565 monitor.indeterminateSubTask( 572 566 trn("Uploading {0} object...", "Uploading {0} objects...", list.size(), list.size())); 573 String diffUploadResponse = send Request("POST","changeset/" + changeset.getId() + "/upload", diffUploadRequest, monitor);567 String diffUploadResponse = sendPostRequest("changeset/" + changeset.getId() + "/upload", diffUploadRequest, monitor); 574 568 575 569 // Process the response from the server … … 633 627 public static String getAuthMethod() { 634 628 return Config.getPref().get("osm-server.auth-method", "oauth"); 629 } 630 631 protected final String sendPostRequest(String urlSuffix, String requestBody, ProgressMonitor monitor) throws OsmTransferException { 632 // Send a POST request that includes authentication credentials 633 return sendRequest("POST", urlSuffix, requestBody, monitor); 634 } 635 636 protected final String sendPutRequest(String urlSuffix, String requestBody, ProgressMonitor monitor) throws OsmTransferException { 637 // Send a PUT request that includes authentication credentials 638 return sendRequest("PUT", urlSuffix, requestBody, monitor); 635 639 } 636 640 … … 820 824 .append(Utils.encodeUrl(text)).toString(); 821 825 822 String response = sendRequest("POST", noteUrl, null, monitor, true, false); 823 return parseSingleNote(response); 826 return parseSingleNote(sendPostRequest(noteUrl, null, monitor)); 824 827 } 825 828 … … 838 841 .append(Utils.encodeUrl(comment)).toString(); 839 842 840 String response = sendRequest("POST", noteUrl, null, monitor, true, false); 841 return parseSingleNote(response); 843 return parseSingleNote(sendPostRequest(noteUrl, null, monitor)); 842 844 } 843 845 … … 860 862 } 861 863 862 String response = sendRequest("POST", urlBuilder.toString(), null, monitor, true, false); 863 return parseSingleNote(response); 864 return parseSingleNote(sendPostRequest(urlBuilder.toString(), null, monitor)); 864 865 } 865 866 … … 882 883 } 883 884 884 String response = sendRequest("POST", urlBuilder.toString(), null, monitor, true, false); 885 return parseSingleNote(response); 885 return parseSingleNote(sendPostRequest(urlBuilder.toString(), null, monitor)); 886 886 } 887 887
Note:
See TracChangeset
for help on using the changeset viewer.