HTTP传输带Cookie的方式 如果有用请给我个赞好吗
/**
* HTTP GET请求 带 cookie
* @param url 请求地址
* @return 响应字符串
*/
public static String doGet(String url,Map<String,String> cookie) {
CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null;
String result = "";
try {
// 通过址默认配置创建一个httpClient实例
httpClient = HttpClients.createDefault();
// 创建httpGet远程连接实例
HttpGet httpGet = new HttpGet(url);
// 设置请求头信息,鉴权
httpGet.setHeader("Authorization", "Bearer da3efcbf-0845-4fe3-8aba-ee040be542c0");
StringBuffer cookieStr = new StringBuffer();
Iterator<Entry<String,String>> iterator = cookie.entrySet().iterator();
while (iterator.hasNext()) {
Entry<String,String> next = iterator.next();
cookieStr.append(next.getKey()).append