topic description
sources of topics and their own ideas
related codes
/ / Please paste the code text below (do not replace the code with pictures)
URL url = new URL ("HTTP://km.oa.com");
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setInstanceFollowRedirects(false);
CookieManager manager = new CookieManager();
manager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
CookieHandler.setDefault(manager);
con.getInputStream();
System.out.println(con.getResponseCode());
CookieStore store = manager.getCookieStore();
List<HttpCookie> cookie = store.getCookies();
System.out.println(cookie);
for (HttpCookie coo : cookie) {
System.out.println(coo);
}
String str = con.getHeaderField("set-cookie");
System.out.println(str);
what result do you expect? What is the error message actually seen?