A URLConnection for an http URL will set up the request
line and the MIME header for you as long as you
set its doOutput field to true by
invoking setDoOutput(true).
If you also want to read from the connection, you
should set doInput to true with setDoInput(true) too.
URLConnection uc = u.openConnection();
uc.setDoOutput(true);
uc.setDoInput(true);