Commit a80a68f1 authored by Quxl's avatar Quxl
parents ea30f7b7 f586fe1d
...@@ -155,6 +155,7 @@ public class HttpUtil { ...@@ -155,6 +155,7 @@ public class HttpUtil {
connection.setRequestProperty("Content-Length", String.valueOf(bytes.length)); connection.setRequestProperty("Content-Length", String.valueOf(bytes.length));
if (headers != null) { if (headers != null) {
for (String key : headers.keySet()) { for (String key : headers.keySet()) {
System.out.println(key+"----"+headers.get(key));
connection.setRequestProperty(key, headers.get(key)); connection.setRequestProperty(key, headers.get(key));
} }
} }
......
...@@ -245,6 +245,12 @@ public class HttpsUtil { ...@@ -245,6 +245,12 @@ public class HttpsUtil {
return result; return result;
} }
public static String doPostForJson(String url, String json,Map<String,String> headers) {
String result = HttpUtil.post(url, json, headers,null);
return result;
}
/** /**
* 模拟form表单的形式 ,上传文件 以输出流的形式把文件写入到url中,然后用输入流来获取url的响应 * 模拟form表单的形式 ,上传文件 以输出流的形式把文件写入到url中,然后用输入流来获取url的响应
......
...@@ -1164,5 +1164,9 @@ public class StringUtil { ...@@ -1164,5 +1164,9 @@ public class StringUtil {
} }
return object.toString(); return object.toString();
} }
public static boolean equals(String str1, String str2) {
return str1 == null ? str2 == null : str1.equals(str2);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment