1
我试图在以下代码中使用HttpClient
将数据发送到我的服务器。带有长URI的Android HttpPost
new Thread(new Runnable() {
@Override
public void run() {
try {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(URL_PREFIX + "?" + URLEncodedUtils.format(nameValuePairs, "utf-8"));
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
}
catch (Exception ex) {
ex.printStackTrace();
}
}
}).start();
但是当我尝试发布这个数据到服务器,我得到一个404错误代码,请求失败,当我尝试使用浏览器我得到以下检查链接。
Request-URI Too Long
The requested URL's length exceeds the capacity limit for this server.
Additionally, a 414 Request-URI Too Long error was encountered while trying to use an ErrorDocument to handle the request.
when check my httppost uri link length was 3497 char.
在我的代码我尝试发送base64编码的图像和其他一些参数。任何人都可以帮我解决这个问题吗?或以任何其他方式来实现它?