java http请求设置 格式

        // 打开和URL之间的连接
            HttpURLConnection connection = (HttpURLConnection)realUrl.openConnection();
            // 设置通用的请求属性
            connection.setRequestProperty("accept", "*/*");
            connection.setRequestProperty("connection", "Keep-Alive");
            connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
            connection.setRequestProperty("content-type", "application/json; charset=utf-8");
            connection.setDoOutput(true);
            connection.setRequestMethod("DELETE");

猜你喜欢

转载自www.cnblogs.com/aresblank/p/10031255.html
今日推荐