package me.biezhi.weixin.util; import java.net.HttpURLConnection; import java.util.List; import java.util.Map; import blade.kit.http.HttpRequest; public class CookieUtil { public static String getCookie(HttpRequest request) { HttpURLConnection conn = request.getConnection(); Map<String, List<String>> resHeaders = conn.getHeaderFields(); StringBuffer sBuffer = new StringBuffer(); for (Map.Entry<String, List<String>> entry : resHeaders.entrySet()) { String name = entry.getKey(); if (name == null) continue; // http/1.1 line List<String> values = entry.getValue(); if (name.equalsIgnoreCase("Set-Cookie")) { for (String value : values) { if (value == null) { continue; } String cookie = value.substring(0, value.indexOf(";") + 1); sBuffer.append(cookie); } } } if(sBuffer.length() > 0){ return sBuffer.toString(); } return sBuffer.toString(); } }

qiheideguang LV18
1月22日
周鸣郝 LV2
2024年5月27日
wuying8208 LV15
2023年7月27日
DarlingMeow LV6
2023年5月20日
bbczlitao LV9
2022年12月12日
18650066502 LV12
2022年11月28日
zhenghaokana LV2
2022年6月22日
dasen2022 LV6
2022年4月27日
lzlzyw LV14
2022年3月24日
机器人天天 LV1
2022年1月9日