Java HTTP Post postJSON(JSONObject job, HttpURLConnection conn)

Here you can find the source of postJSON(JSONObject job, HttpURLConnection conn)

Description

post JSON

License

Open Source License

Declaration

public static void postJSON(JSONObject job, HttpURLConnection conn) throws IOException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.IOException;

import java.io.OutputStream;

import java.net.HttpURLConnection;

import org.json.JSONObject;

public class Main {
    public static void postJSON(JSONObject job, HttpURLConnection conn) throws IOException {
        conn.setRequestMethod("POST");
        // write it out yo
        OutputStream os = conn.getOutputStream();
        os.write(job.toString().getBytes("UTF-8"));
        os.close();/*from  w w  w. j a v  a 2  s  . co  m*/
    }
}

Related

  1. post(URL url, String contentType, byte[] data)
  2. postCall(JsonObject json, String url)
  3. postData(Reader data, URL endpoint, Writer output)
  4. postForm(String url, Map params)
  5. postHTTPQuery(String url, String urlParameters)
  6. postRaw(URL url, String params)
  7. postURL(final URL url, final String request)
  8. put(String url, String content)
  9. put(URL host, String endpoint, String customer, String name, String version, InputStream in)