Ignore:
Timestamp:
May 3, 2013, 2:25:21 PM (12 years ago)
Author:
alloc
Message:

AEI2.08, AEIUpdater:

File:
1 edited

Legend:

Unmodified
Added
Removed
  • java/ModDepotAccess/src/net/oni2/moddepot/DepotManager.java

    r748 r852  
    77import java.io.IOException;
    88import java.io.InputStreamReader;
    9 import java.io.UnsupportedEncodingException;
    10 import java.net.UnknownHostException;
     9import java.net.HttpURLConnection;
     10import java.net.URL;
    1111import java.util.Date;
    1212import java.util.Enumeration;
     
    1616import java.util.zip.ZipFile;
    1717
     18import net.oni2.ProxySettings;
     19import net.oni2.httpfiledownloader.FileDownloader;
    1820import net.oni2.moddepot.model.File;
    1921import net.oni2.moddepot.model.Node;
     
    2325import net.oni2.moddepot.model.TaxonomyTerm;
    2426import net.oni2.moddepot.model.TaxonomyVocabulary;
    25 import net.oni2.httpfiledownloader.FileDownloader;
    26 
    27 import org.apache.http.HttpResponse;
    28 import org.apache.http.client.methods.HttpHead;
    29 import org.apache.http.client.methods.HttpRequestBase;
    30 import org.apache.http.impl.client.DefaultHttpClient;
     27
    3128import org.json.JSONArray;
    3229import org.json.JSONException;
     
    214211         */
    215212        public boolean checkConnection() {
    216                 HttpRequestBase httpQuery = null;
    217 
    218213                try {
    219                         DefaultHttpClient httpclient = new DefaultHttpClient();
    220                         httpQuery = new HttpHead(DepotConfig.depotUrl);
    221                         HttpResponse response = httpclient.execute(httpQuery);
    222                         int code = response.getStatusLine().getStatusCode();
     214                        HttpURLConnection con = (HttpURLConnection) new URL(
     215                                        DepotConfig.depotUrl).openConnection(ProxySettings
     216                                        .getInstance().getProxy());
     217                        con.setRequestMethod("HEAD");
     218                        int code = con.getResponseCode();
    223219                        return (code >= 200) && (code <= 299);
    224                 } catch (UnknownHostException e) {
    225                 } catch (UnsupportedEncodingException e) {
    226                         e.printStackTrace();
    227220                } catch (IOException e) {
    228221                        e.printStackTrace();
    229                 } finally {
    230                         if (httpQuery != null)
    231                                 httpQuery.releaseConnection();
    232222                }
    233223                return false;
Note: See TracChangeset for help on using the changeset viewer.