List of utility methods to do HTTP Post
void | writeFileFromUrl(URL sourceUrl, File targetFile) write File From Url HttpURLConnection connection = (HttpURLConnection) sourceUrl.openConnection(); connection.setRequestMethod("GET"); InputStream in = connection.getInputStream(); FileOutputStream out = new FileOutputStream(targetFile); FileCopy(in, out, 1024); out.close(); |
void | writeString(HttpURLConnection conn, String content, String charsetName) write String writeString(conn.getOutputStream(), content, charsetName); |
void | writeToConnection(final HttpURLConnection couchdbConnection, final String content) write To Connection try { couchdbConnection.setDoOutput(true); final DataOutputStream dataOutputStream = new DataOutputStream(couchdbConnection.getOutputStream()); dataOutputStream.writeBytes(content); dataOutputStream.flush(); dataOutputStream.close(); } catch (IOException ioe) { throw new RuntimeException(ioe); ... |