Joke Collection Website - Public benefit messages - How does JAVA call the interface?

How does JAVA call the interface?

String send post(String jsonStr,String path)\ x0d \ throws io exception { \ x0d \ byte【】data = jsonStr . getbytes(); \ x0d \ java.net.url URL = newjava.net.url (path); \ x0d \ Java . net . httpur connection conn = \ x0d \(Java . net . httpur connection)URL . open connection(); \ x0d \ conn . setrequestmethod(“POST“); \ x0d \ conn . setconnecttimeout(5 * 1000); //Set the connection timeout to 5 seconds \ x0d \ conn.set readtimeout (20 *1000); //Set the read timeout to 20 seconds \x0d\ // Use URL connection for output, and then set the DoOutput flag to true \ x0d \ conn.set dooutput (true); \ x0d \ \ x0d \ conn . setrequestproperty(“Content-Type“,“text/XML; charset = UTF-8“); \ x0d \//conn . setrequestproperty(“Content-Encoding“,“gzip“); \ x0d \ conn . setrequestproperty(“Content-Length“,string . value of(data . Length)); \ x0d \ output stream out stream = conn . get output stream(); //Returns the output stream \ x0d \ outbound.write (data) written to this connection; \ x0d \ out stream . close(); //Close stream \ x0d \ Stringmsg = ""; //Save the response information after calling the http service \x0d\ // If the request response code is 200, it means success \ x0d \ if (conn.getResponse code () = = 200) {\ x0d \//The code returned by the HTTP server is UTF-8. Therefore, it must be set to UTF-8 to keep the coding uniform, otherwise Chinese garbled code \ x0d \ buffered reader in = new buffered reader (\ x0d \ (input stream) conn.getinputstream (), "UTF-8") will appear; \ x0d \ msg = in . readline(); \ x0d \ in . close(); \ x0d \ } \ x0d \ conn . disconnect(); //Disconnect \ x0d \ return msg; \x0d\ }