clone servlet Cookie - Java Servlet JSP

Java examples for Servlet JSP:Cookie

Description

clone servlet Cookie

Demo Code


import javax.servlet.http.Cookie;

public class Main{
    public static Cookie cloneCookie(Cookie originalCookie) {

        Cookie clonedCookie = new Cookie(originalCookie.getName(),
                originalCookie.getValue());
        clonedCookie.setMaxAge(originalCookie.getMaxAge());
        return clonedCookie;
    }/*  w w w .j  a v  a2s  . co  m*/
}

Related Tutorials