Example usage for javax.servlet.http Cookie setVersion

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

Introduction

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

Prototype

public void setVersion(int v) 

Source Link

Document

Sets the version of the cookie protocol that this Cookie complies with.

Usage

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

/**
 * Persist/save the data using Cookies.//from ww  w  .  jav  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;
}