+1 vote
by
Implement the following Post-Zaros:
url = new URL(url_str);
con = (HttpURLConnection) url.openConnection();
con.setRequestProperty("Content-type", "application/json; charset=utf-8");
con.setRequestProperty("Accept-Charset", "UTF-8");
con.setRequestProperty("Accept", "*/*");
con.setRequestProperty("Accept-Encoding", "gzip");
con.setRequestProperty("User-Agent:", "Android 4.0+");
con.setDoOutput(true);
con.setDoInput(true);
con.setConnectTimeout(13000);
con.setReadTimeout(11000);
con.connect();
Map<String, List<String>> map = con.getHeaderFields();
for (Map.Entry<String, List<String>> entry : map.entrySet()) {
System.out.println("Key : " + entry.getKey() +
" ,Value : " + entry.getValue());
}
String cookie = con.getHeaderField("Set-Cookie");
con.getHeaderFields()returns null. What's wrong ? I can not get headers ? Google did not help. Can you please tell me how to get cookie ?

1 Answer

+1 vote
by
The issue was resolved. Server error.
...