Esempio n. 1
0
  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);
  }
Esempio n. 2
0
 public Controller setLocaleToCookie(Locale locale, int maxAge) {
   setCookie(I18N_LOCALE, locale.toString(), maxAge);
   return this;
 }
Esempio n. 3
0
 /** Write Local to cookie */
 public Controller setLocaleToCookie(Locale locale) {
   setCookie(I18N_LOCALE, locale.toString(), I18N.getI18nMaxAgeOfCookie());
   return this;
 }
Esempio n. 4
0
 /** Remove Cookie. */
 public Controller removeCookie(String name, String path, String domain) {
   setCookie(name, null, 0, path, domain);
   return this;
 }
Esempio n. 5
0
 /** Remove Cookie with path = "/". */
 public Controller removeCookie(String name) {
   setCookie(name, null, 0, "/", null);
   return this;
 }
Esempio n. 6
0
 /** Set Cookie with path = "/". */
 public Controller setCookie(String name, String value, int maxAgeInSeconds) {
   setCookie(name, value, maxAgeInSeconds, "/", null);
   return this;
 }