I'm trying to get cookie in servlet using

Cookie[] cookie = request.getCookies();

but cookie is always null.

So I set them from another servlet and they appear in browser preferences.

Cookie cookie = new Cookie("color", "cyan");
cookie.setMaxAge(24*60*60);
cookie.setPath("/");
response.addCookie(cookie);

I don't understand what's wrong?

Edit
Report