怎么设置HTTP请求方式为MOVE?
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)
------最佳解决方案--------------------额。。。这个不是要你调用http层面上的MOVE方法,估计是API的json参数或者url的请求路径为MOVE,http1.1中所有的方法为:OPTIONS、GET、POST、DELETE、HEAD、TRACE、PUT、CONNECT并没有包含MOVE请求方法
------其他解决方案--------------------MOVE请求?还有这个吗?没见过。。楼主想要来干什么?
------其他解决方案--------------------MOVE https://apis.live.net/v5.0/file.a6b2a7e8f2515e5e.A6B2A7E8F2515E5E!126
Authorization: Bearer ACCESS_TOKEN
Content-Type: application/json
{
"destination": "folder.a6b2a7e8f2515e5e.A6B2A7E8F2515E5E!114"
}
------------------------
若要移动音频,则发出对 /AUDIO_IF 或 /FOLDER_ID 的 MOVE 请求,并在请求正文中指定目标文件夹的 ID
API上面要求的啊,要用MOVE方式的请求
------其他解决方案--------------------
url的请求路径为MOVE什么意思