0

How can i delete one particular row in the http database? I am thinking to use httpDelete like httpGet, but it doesnt work.

This is my code of post and delete. I am affair that by using that deleteMarkerData(), I delete the entire table instead of just one.

public void postCarData() {
    Thread t = new Thread() {
        public void run() {
            HttpClient client = new DefaultHttpClient();
            HttpPost post = new HttpPost( CAR_URI);
            try {
              List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(5);
              nameValuePairs.add(new BasicNameValuePair("name", String.valueOf(lat)));
              nameValuePairs.add(new BasicNameValuePair("description", ""));
              nameValuePairs.add(new BasicNameValuePair("price", String.valueOf(lon)));
              nameValuePairs.add(new BasicNameValuePair("product", UserLogin.accountName ));
              nameValuePairs.add(new BasicNameValuePair("action", "put"));
              post.setEntity(new UrlEncodedFormEntity(nameValuePairs));

              HttpResponse response = client.execute(post);
              BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
              String line = "";
              while ((line = rd.readLine()) != null) {    Log.d(TAG, line);       }
            } catch (IOException e) {   Log.d(TAG, "IOException while trying to conect to GAE"); }
        }
    };
    t.start();
}

public void deleteCarData() throws ClientProtocolException, IOException {
    HttpClient client = new DefaultHttpClient();
    HttpDelete delete = new HttpDelete( CAR_URI );
    client.execute(delete);
}

1 Answer 1

1

You're asking a question about why the server's DELETE method behaves as it does whereas you have posted a question with code for a client of the DELETE method. There is no way to answer this question without knowing what the server behind CAR_URI does

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.