Dec 01

You can store the username of a visitor to your site in a cookie stored on their computer. You send the cookie with the http response, for example when they login.

Cookie cookie= new Cookie("username", username);  

written by objects \\ tags: , ,

Oct 01

Cookies are specified in the response header keyed on ‘Set-Cookie’ so the getHeaderFields() method of URLConnection can be used to retrieve them.

URLConnection conn = new url.openConnection();
Map<String,List<String>> headers = conn.getHeaderFields();
List<String> cookies = headers.get("Set-Cookie");
for (String cookie: cookies)

written by objects \\ tags: ,