26 HAZİRAN 2009, Cuma
Nasıl KOYDU göndermek için, HttpURLConnection HTTP isteği SİLMEK?
java.net.HttpURLConnection HTTP-tabanlı, kalıcı olarak SİL (neredeyse) URL göndermek mümkün olup olmadığını bilmek istiyorum.
Pek çok makale, YAZI göndermek için nasıl bir seçim istekleri İZLEME o kadar tarif okudum ama yine de başarılı bir şekilde PUT ve DELETE istekleri yerine getiren herhangi bir örnek kod bulamadım.
CEVAP
26 HAZİRAN 2009, Cuma
Bir HTTP PUT gerçekleştirmek için:
URL url = new URL("http://www.example.com/resource");
HttpURLConnection httpCon = (HttpURLConnection) url.openConnection();
httpCon.setDoOutput(true);
httpCon.setRequestMethod("PUT");
OutputStreamWriter out = new OutputStreamWriter(
httpCon.getOutputStream());
out.write("Resource content");
out.close();
httpCon.getInputStream();
Bir HTTP SİLMEK gerçekleştirmek için:
URL url = new URL("http://www.example.com/resource");
HttpURLConnection httpCon = (HttpURLConnection) url.openConnection();
httpCon.setDoOutput(true);
httpCon.setRequestProperty(
"Content-Type", "application/x-www-form-urlencoded" );
httpCon.setRequestMethod("DELETE");
httpCon.connect();
Bunu PaylaÅŸ:

Nasıl bir başlık curl çağrısı ile bir ...
Nasıl Http isteği json veri NSURLReque...
Nasıl bir WordPress kullanmak KOYMAK/S...
Değil't küçük bir favicon başka b...
Nasıl js veya jQuery ile ajax isteği i...