Reputation: 1244
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);
i am using httpclient to post on server using above code. but i got response like this
Your post request is not being received quickly enough please retry
i have add permissions and jar files correctly,also tried with basicnamevaluepair but same response. httpclient deprecated but it should work know...
i don't know the reason. what i am doing wrong. any help pls...
Upvotes: 2
Views: 1228
Reputation: 21
This is my way to create tab:
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);
}
}
Upvotes: 0
Reputation: 68715
The server you are trying to hit has 'Slow HTTP Post DDoS Attacks' enabled, which is rejecting your request. The rule generally has some allowed time to receive the whole request, if it does not then the request will be denied.
Upvotes: 1