none
Connect the SkyDrive, use the REST method to delete the file RRS feed

  • 常规讨论

  • Why can you appear:

    org.apache.http.conn.HttpHostConnectException: Connection to http://apis.live.net refused
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:159)
    at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149)
    at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:108)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:415)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:641)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:576)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:554)
    at com.aomei.httprequest.HttpHelper.deleteRequest(HttpHelper.java:145)
    at com.aomei.test.SkyDriveTest.testDeleteFolder(SkyDriveTest.java:109)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at junit.framework.TestCase.runTest(TestCase.java:168)
    at junit.framework.TestCase.runBare(TestCase.java:134)
    at junit.framework.TestResult$1.protect(TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)

    -----------------------------------------------------------------------

    Source code

    public  String deleteRequest(String url) throws RestHttpException, HttpException{
    logger.debug("delete "+ url);
    final HttpDelete delete = new HttpDelete(url);
    System.out.println(delete.getMethod()); 
    try {
    HttpResponse resp = newHttpClient().execute(delete);
    System.out.println(resp.getStatusLine().getStatusCode()); 
    } catch (ClientProtocolException e) {
    e.printStackTrace();
    } catch (IOException e) {
    e.printStackTrace();
    }
    return null;
    }

    ------------------------

    Help me.

    2012年11月5日 10:46