使用HttpURLConnection 如何设置请求cookie呢?
huc.addRequestProperty("content-type", contentType); if (ValueWidget.isHasValue(cookie)) { huc.setRequestProperty("Cookie", cookie); }
如何获取应答的cookie呢?
String session_value = huc
.getHeaderField(SystemHWUtil.KEY_HEADER_COOKIE);
SystemHWUtil.KEY_HEADER_COOKIE的值为"Set-Cookie"
public static final String KEY_HEADER_COOKIE="Set-Cookie";