2
HttpClient httpclient = new DefaultHttpClient();
            HttpPost httppost = new HttpPost(
                    "http://xxxxxxx/geo/getlocation.php");

            MultipartEntity reqEntity = new MultipartEntity(
                    HttpMultipartMode.BROWSER_COMPATIBLE);

            reqEntity.addPart("longtiude", new StringBody(mylong));
            reqEntity.addPart("latitude", new StringBody(mylat));
            reqEntity.addPart("newtimeString", new StringBody(time));
            reqEntity.addPart("dateString", new StringBody(date));
            reqEntity.addPart("locationName", new StringBody(address));

            httppost.setEntity(reqEntity);

            HttpResponse response = httpclient.execute(httppost);

            String responseBody = EntityUtils
                    .toString(response.getEntity());
            Log.e("response", responseBody);

我正在使用 httpclient 使用上面的代码在服务器上发布。但我得到了这样的回应

Your post request is not being received quickly enough please retry

我已正确添加权限和 jar 文件,也尝试使用 basicnamevaluepair 但响应相同。httpclient 已弃用,但它应该知道...

我不知道原因。我做错了什么。任何帮助请...

4

2 回答 2

1

您尝试访问的服务器启用了“慢速 HTTP Post DDoS 攻击”,这会拒绝您的请求。该规则通常有一些允许的时间来接收整个请求,如果没有,则该请求将被拒绝。

于 2013-07-13T09:47:23.090 回答
0

这是我创建标签的方式:

public class MainActivity extends TabActivity {

TabHost tabHost;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Resources res=getResources();
    tabHost=getTabHost();
    TabHost.TabSpec spec;
    Intent in;



    in=new Intent().setClass(this, Search.class);
    spec=tabHost.newTabSpec("Search").setIndicator("Search",res.getDrawable(R.drawable.ic_launcher)).setContent(in);
       tabHost.addTab(spec);



    in=new Intent().setClass(this, Search2.class);
    spec=tabHost.newTabSpec("Point").setIndicator("Point",res.getDrawable(R.drawable.ic_launcher)).setContent(in);
       tabHost.addTab(spec);


     in = new Intent().setClass(this, Search3.class);
       spec = tabHost.newTabSpec("social").setIndicator("Social",
                          res.getDrawable(R.drawable.ic_launcher))
                      .setContent(in);
      tabHost.addTab(spec);

        // Contact tabs
        in = new Intent().setClass(this, Search4.class);
        spec = tabHost.newTabSpec("contact").setIndicator("Contact",
                          res.getDrawable(R.drawable.ic_launcher))
                      .setContent(in);

        tabHost.addTab(spec);
        tabHost.setCurrentTab(0);
}
}
于 2013-07-13T12:51:21.110 回答