1

I am trying to set request parameters, some tutorials say to use setentity, however setentity is not present for HttpDelete. How can I get a uniform method to work with all 4 request methods? Thanks!

Alvin Baena
  • 903
  • 1
  • 10
  • 24
nubela
  • 1
  • 24
  • 75
  • 123

1 Answers1

0

EDIT

Well, according to what you corrected, you may need to use query strings in the request URI. The parsing has to be done manually, but it's not exceptionally hard.

See here and here to know how query strings work.

Community
  • 1
  • 1
Alvin Baena
  • 903
  • 1
  • 10
  • 24
  • are we talking about parameters for requests here? i might have made a mistake, it might not be header, just parameters for a request that is usually sent with post requests. – nubela Dec 24 '11 at 13:59
  • i looked at setHeader() method, and it is not that. it should be something that would accept a list of named value pair. like a dictionary. – nubela Dec 24 '11 at 14:00
  • I'm not sure if you read the Method Definitions section of the RFC (http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html), here it's stated that the DELETE method does not need anything besides the URI of the resource to be deleted – Alvin Baena Dec 24 '11 at 14:03
  • query strings even for POST method? – nubela Dec 24 '11 at 14:33
  • your method seems to be entirely different from this: http://stackoverflow.com/questions/3288823/how-to-add-parameters-in-android-http-post , given that setEntity exists for POST/PUT, and GET uses query strings, i'm just wondering about DELETE. – nubela Dec 24 '11 at 14:35
  • Well the DELETE method only requires the location of the resource to be deleted, so I don't know why would you need a key value pair 'like' query for a DELETE method, but you may do a GET first get the desired element with the query string needed, and use the response entity to DELETE the resource. Right now it's what it comes to my head... – Alvin Baena Dec 24 '11 at 14:55