Changeset 852 for java/ModDepotAccess


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

AEI2.08, AEIUpdater:

Location:
java/ModDepotAccess
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • java/ModDepotAccess/.classpath

    r748 r852  
    33        <classpathentry kind="src" path="src"/>
    44        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
    5         <classpathentry kind="lib" path="/_ThirdPartyLibs/httpclient/commons-logging-1.1.1.jar"/>
    6         <classpathentry kind="lib" path="/_ThirdPartyLibs/httpclient/httpclient-4.2.2.jar"/>
    7         <classpathentry kind="lib" path="/_ThirdPartyLibs/httpclient/httpcore-4.2.2.jar"/>
    85        <classpathentry kind="lib" path="/_ThirdPartyLibs/JSON-java.jar"/>
    96        <classpathentry kind="lib" path="/_ThirdPartyLibs/xstream-1.4.3.jar"/>
    107        <classpathentry combineaccessrules="false" kind="src" path="/HTTPFileDownloader"/>
     8        <classpathentry combineaccessrules="false" kind="src" path="/ProxySettings"/>
    119        <classpathentry kind="output" path="bin"/>
    1210</classpath>
  • 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.