研究了一下HttpURLConnection的源码: 在使用的时候都是通过URL.openConnection()来获取HttpURLConnection对象,然后调用其connect方法进行链接,所以先从URL.penConnection()入手: /** * Returns a new connection to the resource referred to by this URL. * * @throws IOException if an error occurs while ope
From https://developer.android.com/reference/java/net/HttpURLConnection.html HttpUrlConnection: A URLConnection with support for HTTP-specific features. See the specfor details. Uses of this class follow a pattern: Obtain a new HttpURLConnection by c
1.HttpURLConnection发送url请求 public class JavaRequest { private static final String BASE_URL = "http://localhost:8080/dsdemo/"; public static String userToken = null; public static String problemName = null; public static String sendPost(String su