Example usage for javax.servlet.http Cookie setComment

List of usage examples for javax.servlet.http Cookie setComment

Introduction

In this page you can find the example usage for javax.servlet.http Cookie setComment.

Prototype

public void setComment(String purpose) 

Source Link

Document

Specifies a comment that describes a cookie's purpose.

Usage

From source file:wicket.markup.html.form.persistence.CookieValuePersister.java

/**
 * Persist/save the data using Cookies.//  w  ww. j  av a  2 s.co  m
 * 
 * @param cookie
 *            The Cookie to be persisted.
 * @return The cookie provided
 */
private Cookie save(final Cookie cookie) {
    if (cookie == null) {
        return null;
    }

    final String comment = getSettings().getComment();
    if (comment != null) {
        cookie.setComment(comment);
    }

    final String domain = getSettings().getDomain();
    if (domain != null) {
        cookie.setDomain(domain);
    }

    cookie.setPath(getWebRequest().getContextPath());

    cookie.setVersion(getSettings().getVersion());
    cookie.setSecure(getSettings().getSecure());

    getWebResponse().addCookie(cookie);

    if (log.isDebugEnabled()) {
        log.debug("saved: " + cookieToDebugString(new CookieWrapper(cookie)));
    }

    return cookie;
}