I've done some googling and found that I needed to try looping though the different fields by index instead of trying to get the value by name. I used the following code that claimed to work
Expand|Select|Wrap|Line Numbers
- for (int i=1; (headerName = conn.getHeaderFieldKey(i))!=null; i++) {
- System.out.println(headerName);
- if (headerName.equals("Set-Cookie")) {
- cookie += conn.getHeaderField(i); }
- }
Other examples I've seen look like this or say only that i must access by index instead of name and it will work.