public String move(String folderid,String destinationFolderid,String urls) throws IOException{
URL url = new URL(urls);
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setRequestMethod("MOVE");
connection.setUseCaches(false);
    connection.setInstanceFollowRedirects(true);
    connection.setRequestProperty("Content-Type","application/json");
    connection.connect();
        //MOVE请求
    DataOutputStream out = new DataOutputStream(connection.getOutputStream());
    JSONObject obj = new JSONObject();
    obj.element("destination", destinationFolderid);  
    out.writeBytes(obj.toString());
    out.flush();
    out.close();
}
-------------------------------------
报错了
java.net.ProtocolException: Invalid HTTP method: MOVE
at java.net.HttpURLConnection.setRequestMethod(HttpURLConnection.java:333)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.setRequestMethod(HttpsURLConnectionImpl.java:354)
at com.aomei.httprequest.HttpHelper.move(HttpHelper.java:75)

解决方案 »

  1.   

    什么叫http请求是move方式有  get,poset,put,delete,还没见过move方式的.
      

  2.   

    post
      

  3.   

    MOVE https://apis.live.net/v5.0/file.a6b2a7e8f2515e5e.A6B2A7E8F2515E5E!126
    微软API上面写的
    To move an audio, make a MOVE request to /AUDIO_IF or /FOLDER_ID, and specify the ID of the destination folder in the request body, as shown here.http://blog.csdn.net/anbo724/article/details/6008640
    这个文章里也写了啊,但是不知道怎么用
      

  4.   


    public void setRequestMethod(String method) throws ProtocolException {
    for (int i = 0; i < methods.length; i++) {
        if (methods[i].equals(method)) {
    this.method = method;
    return;
        }
    }
    throw new ProtocolException("Invalid HTTP method: " + method);
        }
     /* valid HTTP methods */
        private static final String[] methods = {
    "GET", "POST", "HEAD", "OPTIONS", "PUT", "DELETE", "TRACE"
        };
    不支持
      

  5.   

    MOVE https://apis.live.net/v5.0/file.a6b2a7e8f2515e5e.A6B2A7E8F2515E5E!126
    微软API上面写的
    To move an audio, make a MOVE request to /AUDIO_IF or /FOLDER_ID, and specify the ID of the destination folder in the request body, as shown here.
    http://blog.csdn.net/anbo724/article/details/6008640
    这个文章里也写了啊,但是不知道怎么用