Codenameone 代号一-NetworManager&;连接请求-post/get can';不能修改

Codenameone 代号一-NetworManager&;连接请求-post/get can';不能修改,codenameone,Codenameone,每次调用请求时,我都会收到一个错误。 当我用request.setPost(false)注释行时,我从服务器得到一些响应。 请解释出现此错误的原因 线程“thread-6”java.lang.IllegalStateException中的异常:请求方法(post/get)不能修改一个参数 <pre> <code> public static void MyVimeo(final String file) { new Thread(new Runnable() { publ

每次调用请求时,我都会收到一个错误。 当我用request.setPost(false)注释行时,我从服务器得到一些响应。 请解释出现此错误的原因

线程“thread-6”java.lang.IllegalStateException中的异常:请求方法(post/get)不能修改一个参数

<pre>
<code>
public static void MyVimeo(final String file) {
new Thread(new Runnable() {
public void run() {
Log.p("File Name : " + file);
String consumer_key = "";
String consumer_secret = "";
String vimeoAPIURL = "http://vimeo.com/api/rest/v2";
String reqTokenEP = "http://vimeo.com/oauth/request_token";
String AUTHORIZATION_URL = "http://vimeo.com/oauth/authorize?oauth_token=";
String accTokenEP = "http://vimeo.com/oauth/access_token";
String accToken = "";
String accTokenPass = "";

NetworkManager networkManager = NetworkManager.getInstance();
networkManager.start();
networkManager.addErrorListener(new ActionListener() {

public void actionPerformed(ActionEvent evt) {
NetworkEvent n = (NetworkEvent) evt;
n.getError().printStackTrace();
}
});

ConnectionRequest request = new ConnectionRequest() {
int chr;
StringBuffer sb = new StringBuffer();
String response = "";

protected void readResponse(InputStream input) throws IOException {
// do something with input stream
while ((chr = input.read()) != -1) {
sb.append((char) chr);
// System.out.println("reading...");
}
response = sb.toString();
Log.p("Response->" + response);
if (response.equals("OK")) {
Dialog.show("Response", "Authenticated", "Ok", null);
} 
else {
Dialog.show("Response", "Failed", "Ok", null);
}
}

protected void handleException(Exception err) {
// do something with err
Dialog.show("Connection Err!!", "Are you connected to the internet? Check your connection", "Ok", null);
}
};

request.setUrl(vimeoAPIURL);
request.addArgument("format", "xml");
request.addArgument("method", "vimeo.videos.upload.getQuota");
request.addArgument("oauth_consumer_key", consumer_key);
request.addArgument("oauth_version","1.0");
request.addArgument("oauth_signature_method", "HMAC-SHA1");
request.addArgument("oauth_token", accToken);
Log.p("vimeoAPIURL->" + vimeoAPIURL + " called");
request.setPost(false); //error here

networkManager.addToQueue(request);
}
}).start();
}
</code>
</pre>

在添加任何参数之前,必须调用
setPost
。只需在所有addArgument调用之前调用它。实际误差为:

在目前的版本中,有一个拼写错误,它说的是一次而不是一次

"Request method (post/get) can't be modified once arguments have been assigned to the request"