Пример #1
0
  /**
   * Add or update a cookie. This method adds a cookie, serializing its value using XML.
   *
   * @param name The cookie name.
   * @param value The cookie value
   */
  public static void addCookie(String name, String value) {
    int maxAge = 3600 * 24 * 365;

    if (value == null) {
      maxAge = 0;
      value = "";
    }

    Cookie cookie = new Cookie(name, value);
    cookie.setMaxAge(maxAge);
    cookie.setPath("/");
    // TODO cookie.setDomain(SystemGlobals.getValue(ConfigKeys.));

    JForumExecutionContext.getResponse().addCookie(cookie);
  }
Пример #2
0
  /**
   * Add or update a cookie. This method adds a cookie, serializing its value using XML.
   *
   * @param name The cookie name.
   * @param value The cookie value
   */
  public static void addCookie(String name, String value) {

    LOG.trace("addCookie");
    int maxAge = 3600 * 24 * 365;

    if (value == null) {
      maxAge = 0;
      value = "";
    }

    Cookie cookie = new Cookie(name, value);
    cookie.setMaxAge(maxAge);
    cookie.setPath("/");

    JForumExecutionContext.getResponse().addCookie(cookie);
  }