public static void setCookie ( HttpServletResponse response , String name , String value , String path ) { Cookie cookie = new Cookie ( name , value ) ; cookie . setSecure ( false ) ; cookie . setPath ( path ) ; cookie . setMaxAge ( 3600 * 24 * 30 ) ; // 30 days response . addCookie ( cookie ) ; }
Convenience method to set a cookie