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