Я пытаюсь отправить запрос на удаление на Rails Server с J2ME
Выход
STATUS: 422
и элемент не удаляется.
Вот код:
HttpConnection hc = null;
InputStream istrm = null;
String msg = "_method=DELETE";
System.out.println(id);
try {
hc = (HttpConnection) Connector.open(server + "documents/" + id + ".xml");
hc.setRequestMethod(HttpConnection.POST);
hc.setRequestProperty("Content-type", "application/x-www-form-urlencoded");
hc.setRequestProperty("Content-length", "" + msg.getBytes().length);
OutputStream out = hc.openOutputStream();
out.write(msg.getBytes());
out.close();
System.out.println("STATUS: " + hc.getResponseCode()+ hc.getResponseMessage());