Der Code ist wie folgt:
importieren java.io.bufufferedReader; import Java.io.dataoutputStream; Import Java.io.ioException; importieren Sie Java.io.inputStreamReader; Java.net.httpurlconnection; importieren java.net. Cloud // Schnittstelle private endgültige statische String url = "https HttpurlConnection Connection = Connection (URL); DataOutputStream Out = new DataOutputStream (connection.getOutputStream ()); JsonObject obj = new JsonObject (); obj.element ("identifier", "hehe"); Reader = New BufferedReader (neuer InputStreamReader (connection.getInputStream ()); String -Linien; StringBuffer SB = New StringBuffer (""); while ((Lines = reader.readline ())! = null) {line = new String (line.getBytes (), "utf-8"); (HttpurlConnection) url.openconnection (); connection.setDooutput (true); connection.setDoInput (true); connection.setRequestMethod ("post"); connection.setUSecaches (false); Verbindung. setInstanceFollowredirects (true); Connection.SetRequestProperty ("Content-Typ", "Anwendung/x-www-form-rencoded; charSet = utf-8"); connect.Connect (); Verbindung; // Todo automatisch generierte Methode Stub}}Das obige Beispiel dafür, dass Java Anforderungen an die Backend Server -Schnittstelle im JSON -Format sendet, ist der gesamte Inhalt, den ich mit Ihnen teile. Ich hoffe, Sie können Ihnen eine Referenz geben und ich hoffe, Sie können wulin.com mehr unterstützen.