public static void put(Controller ctr, String key, String value, int maxAgeInSeconds) { String encrypt_key = PropKit.get("encrypt_key"); String saveTime = System.currentTimeMillis() + ""; String encrypt_value = encrypt(encrypt_key, saveTime, maxAgeInSeconds + "", value); String cookieValue = encrypt_value + COOKIE_SEPARATOR + saveTime + COOKIE_SEPARATOR + maxAgeInSeconds + COOKIE_SEPARATOR + value; ctr.setCookie(key, cookieValue, maxAgeInSeconds); }
public Controller setLocaleToCookie(Locale locale, int maxAge) { setCookie(I18N_LOCALE, locale.toString(), maxAge); return this; }
/** Write Local to cookie */ public Controller setLocaleToCookie(Locale locale) { setCookie(I18N_LOCALE, locale.toString(), I18N.getI18nMaxAgeOfCookie()); return this; }
/** Remove Cookie. */ public Controller removeCookie(String name, String path, String domain) { setCookie(name, null, 0, path, domain); return this; }
/** Remove Cookie with path = "/". */ public Controller removeCookie(String name) { setCookie(name, null, 0, "/", null); return this; }
/** Set Cookie with path = "/". */ public Controller setCookie(String name, String value, int maxAgeInSeconds) { setCookie(name, value, maxAgeInSeconds, "/", null); return this; }