I can\'t retrieve cookie maxage it always returns -1
Creating cookie:
Cookie securityCookie = new Cookie(\"sec\", \"somevalue\");
securityCookie.setMaxAg
When a browser sends a cookie back to the origin server, it doesn't include any age. So it is logical that your "retrieve" code above does not receive a max age: it is not included in the request.
When the cookie is received from the server, the browser uses the max age parameter to determine how long the cookie should be kept; the age is never communicated back to the server, an expired cookie is simply discarded. When processing a request, if you want to renew the age of the cookie, reinclude the cookie in the response.
Also see the section "Sending Cookies to the Origin Server" in the RFC.