Usted puede hacer solicitud DELETE con el cuerpo a través de tomas de corriente, el código Java de ejemplo que comprueba HTTPRequest y lo hace diferente solicitud para ELIMINAR con cuerpo:
public static HTTPResponse execute(HTTPRequest request) throws ExecutionException, InterruptedException {
if (request == null) {
throw new IllegalArgumentException("Missing request!");
}
if (request.getMethod() == HTTPMethod.DELETE && request.getPayload() != null && request.getPayload().length > 0) {
URL obj = request.getURL();
SSLSocketFactory socketFactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
try {
HttpsURLConnection con = (HttpsURLConnection) obj.openConnection();
HttpsURLConnection.setDefaultSSLSocketFactory(socketFactory);
con.setRequestMethod("DELETE");
for (HTTPHeader httpHeader : request.getHeaders()) {
con.setRequestProperty(httpHeader.getName(), httpHeader.getValue());
}
con.setDoOutput(true);
con.setDoInput(true);
OutputStream out = con.getOutputStream();
out.write(request.getPayload());
out.flush();
out.close();
List<HTTPHeader> responseHeaders = new ArrayList<>();
for (Map.Entry<String, List<String>> stringListEntry : con.getHeaderFields().entrySet()) {
for (String value : stringListEntry.getValue()) {
responseHeaders.add(new HTTPHeader(stringListEntry.getKey(), value));
}
}
return new HTTPResponse(con.getResponseCode(), StreamUtils.getBytes(con.getInputStream()), con.getURL(), responseHeaders);
} catch (IOException e) {
log.severe(e.getMessage());
}
} else {
Future<HTTPResponse> future = URLFetchServiceFactory.getURLFetchService().fetchAsync(request);
return future.get();
}
return null;
}
De acuerdo, parece un error. –
Acepto, he destacado y comentado el problema aquí: http://code.google.com/p/googleappengine/issues/detail?id=601&q=post%20delete&colspec=ID%20Type%20Status%20Priority%20Stars% 20Propietario% 20Summary% 20Log% 20Component – elkelk
elkelk, ese error no está relacionado con la pregunta aquí. –