kopia lustrzana https://github.com/JOSM/MapWithAI
BoundingBoxMapWithAIDownloader: Use response headers to determine parser
Signed-off-by: Taylor Smock <tsmock@fb.com>pull/1/head v1.9.2
rodzic
385c16a061
commit
516a508620
|
@ -32,7 +32,6 @@ import org.openstreetmap.josm.io.OsmTransferException;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.MapWithAIPlugin;
|
import org.openstreetmap.josm.plugins.mapwithai.MapWithAIPlugin;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIConflationCategory;
|
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIConflationCategory;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo;
|
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIInfo;
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.data.mapwithai.MapWithAIType;
|
|
||||||
import org.openstreetmap.josm.plugins.mapwithai.tools.MapPaintUtils;
|
import org.openstreetmap.josm.plugins.mapwithai.tools.MapPaintUtils;
|
||||||
import org.openstreetmap.josm.tools.HttpClient;
|
import org.openstreetmap.josm.tools.HttpClient;
|
||||||
import org.openstreetmap.josm.tools.Logging;
|
import org.openstreetmap.josm.tools.Logging;
|
||||||
|
@ -168,10 +167,9 @@ public class BoundingBoxMapWithAIDownloader extends BoundingBoxDownloader {
|
||||||
@Override
|
@Override
|
||||||
protected DataSet parseDataSet(InputStream source, ProgressMonitor progressMonitor) throws IllegalDataException {
|
protected DataSet parseDataSet(InputStream source, ProgressMonitor progressMonitor) throws IllegalDataException {
|
||||||
DataSet ds;
|
DataSet ds;
|
||||||
String contentType = this.activeConnection.getResponse().getHeaderField("Content-Type");
|
String contentType = this.activeConnection.getResponse().getContentType();
|
||||||
if (contentType.contains("text/xml")) {
|
if (contentType.contains("text/json") || contentType.contains("application/json")
|
||||||
ds = OsmReader.parseDataSet(source, progressMonitor, OsmReader.Options.SAVE_ORIGINAL_ID);
|
|| contentType.contains("application/geo+json")) {
|
||||||
} else if (MapWithAIType.ESRI_FEATURE_SERVER == this.info.getSourceType()) {
|
|
||||||
ds = GeoJSONReader.parseDataSet(source, progressMonitor);
|
ds = GeoJSONReader.parseDataSet(source, progressMonitor);
|
||||||
if (info.getReplacementTags() != null) {
|
if (info.getReplacementTags() != null) {
|
||||||
GetDataRunnable.replaceKeys(ds, info.getReplacementTags());
|
GetDataRunnable.replaceKeys(ds, info.getReplacementTags());
|
||||||
|
|
Ładowanie…
Reference in New Issue