Sie haben POST

Hurra!
Java Micro Edition an Ruby on Rails: wir haben Nachrichten!
und das ganze mit ein bisschen:

try {
	connection = (HttpConnection)Connector.open(url);
	connection.setRequestMethod("POST");
	connection.setRequestProperty("User-Agent", "Claudius im J2ME :D");
	
	String postdata = "message[text]=ich+bin+toll&message[subject]=J2ME+Ruled!";
	byte[] body = postdata.getBytes();
	connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
	connection.setRequestProperty("Content-Length", Integer.toString(body.length));
	os = connection.openOutputStream();
	os.write(body);
} catch (Exception ex) {
	System.out.println(ex.toString());
	ex.printStackTrace();
} finally {
	if(os != null) {
		os.close();
	}
	if(is != null) {
		is.close();
	}
	if(connection != null) {
		connection.close();
	}
}       

Weiter gehen. Hier gibt es nichts zu sehen.

2 Gedanken zu „Sie haben POST“

Kommentare sind geschlossen.