FileDocCategorySizeDatePackage
CookieBean.javaAPI DocExample1767Tue Apr 29 13:42:20 BST 2003com.jspservletcookbook

CookieBean

public class CookieBean extends Object

Fields Summary
private Cookie
cookie
Constructors Summary
public CookieBean()


 
Methods Summary
public java.lang.StringgetName()


    if (cookie != null)
       return cookie.getName();
    else
       return "unavailable";
       
       
public java.lang.StringgetPath()


    if (cookie != null)
       return cookie.getPath();
    else
       return "unavailable";
       
       
public java.lang.StringgetValue()


    if (cookie != null)
       return cookie.getValue();
    else
       return "unavailable";
       
       
public voidsetCookieHeader(javax.servlet.http.HttpServletResponse response)


    if (response == null )
        throw new IllegalArgumentException("Invalid HttpServletResponse set in: "+getClass().getName());
    if (cookie != null)
        response.addCookie(cookie);
public voidsetMaxAge(int maxAge)

    
    if (cookie != null)
        cookie.setMaxAge(maxAge);

public voidsetName(java.lang.String name)


    if (name == null || (name.equals("")))
        throw new IllegalArgumentException("Invalid cookie name set in: "+getClass().getName());
    
    cookie = new Cookie(name,""+new java.util.Date().getTime());
public voidsetPath(java.lang.String path)


 if (path == null || (path.equals("")))
        throw new IllegalArgumentException("Invalid cookie path set in: "+getClass().getName());
    
    if (cookie != null)
        cookie.setPath(path);
public voidsetValue(java.lang.String value)


 if (value == null || (value.equals("")))
        throw new IllegalArgumentException("Invalid cookie value set in: "+getClass().getName());
    
    if (cookie != null)
        cookie.setValue(value);