Cookie cookie = getCookie(req); int count = Integer.parseInt(cookie.getValue()); count++; cookie.setValue(String.valueOf(count)); res.addCookie(cookie);
Cookie[] cookies = req.getCookies(); if (cookies != null) { for (int i = 0; i < cookies.length; i++) { if (TEST_COOKIE_NAME.equals(cookies[i].getName())) { return cookies[i]; } } } return new Cookie(TEST_COOKIE_NAME, "0");