我正在开发一个需要http标头来存储Cookie的应用。出于某种原因,原始标题是
GET /app?service=page/UserWebPrint HTTP/1.1
Host:xxxyyy
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
Cookie: cookievalue1;cookievalue2
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36
X-Client-Data: CKW2yQEIxLbJAQj9lcoBCJKXygE=
HTTP/1.1 200 OK
Cache-Control: no-cache
Cache-Control: no-store
Content-Encoding: gzip
Content-Type: text/html; charset=utf-8
Date: Sat, 05 Mar 2016 19:08:55 GMT
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Pragma: no-cache
Transfer-Encoding: chunked
X-Frame-Options: SAMEORIGIN
但输出:
Map<String, List<String>> headerFields1 = conn2.getHeaderFields()
System.out.println(headerFields1);
是:
{Cache-Control=[no-cache, no-store], Content-Type=[text/html; charset=utf-8], Date=[Sat, 05 Mar 2016 19:17:52 GMT], Expires=[Thu, 01 Jan 1970 00:00:00 GMT], Pragma=[no-cache], Transfer-Encoding=[chunked], X-Frame-Options=[SAMEORIGIN]}
如何访问Cookie?