Ignore:
Timestamp:
2015-12-26T23:41:52+01:00 (5 years ago)
Author:
simon04
Message:

see #12231 - Uniform access to HTTP resources

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/plugins/PluginDownloadTask.java

    r9059 r9168  
    1010import java.io.InputStream;
    1111import java.io.OutputStream;
    12 import java.net.HttpURLConnection;
    1312import java.net.MalformedURLException;
    1413import java.net.URL;
     
    2221import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
    2322import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    24 import org.openstreetmap.josm.io.CachedFile;
    2523import org.openstreetmap.josm.tools.CheckParameterUtil;
     24import org.openstreetmap.josm.tools.HttpClient;
    2625import org.xml.sax.SAXException;
    2726
     
    4544    private final Collection<PluginInformation> downloaded = new LinkedList<>();
    4645    private boolean canceled;
    47     private HttpURLConnection downloadConnection;
     46    private HttpClient.Response downloadConnection;
    4847
    4948    /**
     
    124123            URL url = new URL(pi.downloadlink);
    125124            synchronized (this) {
    126                 downloadConnection = CachedFile.connectFollowingRedirect(url, PLUGIN_MIME_TYPES, null);
     125                downloadConnection = HttpClient.create(url)
     126                        .setAccept(PLUGIN_MIME_TYPES)
     127                        .connect();
    127128            }
    128129            try (
    129                 InputStream in = downloadConnection.getInputStream();
     130                InputStream in = downloadConnection.getContent();
    130131                OutputStream out = new FileOutputStream(file)
    131132            ) {
Note: See TracChangeset for help on using the changeset viewer.