Java HTTP Post writeBody(HttpURLConnection connection, String body)

Here you can find the source of writeBody(HttpURLConnection connection, String body)

Description

write Body

License

LGPL

Declaration

private static void writeBody(HttpURLConnection connection, String body) throws Exception 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.io.OutputStream;
import java.net.HttpURLConnection;

public class Main {
    private static void writeBody(HttpURLConnection connection, String body) throws Exception {
        OutputStream stream = connection.getOutputStream();
        stream.write(body.getBytes());//  w  w  w  . j  a v a2s .co m
        stream.flush();
        stream.close();
    }
}

Related

  1. sendPost(String webURL, HashMap postOptions)
  2. sendPostRequest(Reader data, URL endpoint, Writer output)
  3. sendPostRequest(Reader data, URL endpoint, Writer output)
  4. sendPostRequest(String requestURL, Map params)
  5. URLPost(String strUrl, Map map)
  6. writeContent(HttpURLConnection urlConn, String content)
  7. writeFileFromUrl(URL sourceUrl, File targetFile)
  8. writeString(HttpURLConnection conn, String content, String charsetName)
  9. writeToConnection(final HttpURLConnection couchdbConnection, final String content)