Changeset 14216 in josm


Ignore:
Timestamp:
2018-09-01T16:40:32+02:00 (6 years ago)
Author:
Don-vip
Message:

allow to download OSM JSON from RemoteControl

Location:
trunk/src/org/openstreetmap/josm/io
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/OsmServerLocationReader.java

    r13572 r14216  
    200200                return null;
    201201            progressMonitor.subTask(tr("Downloading OSM data..."));
    202             return OsmReader.parseDataSet(compression.getUncompressedInputStream(in), progressMonitor.createSubTaskMonitor(1, false));
     202            InputStream uncompressedInputStream = compression.getUncompressedInputStream(in);
     203            ProgressMonitor subTaskMonitor = progressMonitor.createSubTaskMonitor(1, false);
     204            if ("application/json".equals(contentType)) {
     205                return OsmJsonReader.parseDataSet(uncompressedInputStream, subTaskMonitor);
     206            } else {
     207                return OsmReader.parseDataSet(uncompressedInputStream, subTaskMonitor);
     208            }
    203209        }
    204210    }
  • trunk/src/org/openstreetmap/josm/io/OsmServerReader.java

    r14119 r14216  
    4343    private boolean doAuthenticate;
    4444    protected boolean gpxParsedProperly;
     45    protected String contentType;
    4546
    4647    /**
     
    190191            try {
    191192                response = client.connect(progressMonitor);
     193                contentType = response.getContentType();
    192194            } catch (IOException e) {
    193195                Logging.error(e);
     
    210212                    String errorBody = fetchResponseText(response);
    211213                    throw new OsmApiException(response.getResponseCode(), errorHeader, errorBody, url.toString(), null,
    212                             response.getContentType());
     214                            contentType);
    213215                }
    214216
Note: See TracChangeset for help on using the changeset viewer.