KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > javax > servlet > http > Cookie

javax.servlet.http
Class Cookie

java.lang.Object
  extended byjavax.servlet.http.Cookie
All Implemented Interfaces:
Cloneable
See Also:
Top Examples, Source Code, HttpServletRequest.getCookies(), HttpServletResponse.addCookie(javax.servlet.http.Cookie)

public Object clone()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public Cookie(String name,
              String value)
See Also:
setVersion(int), setValue(java.lang.String), IllegalArgumentException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String getComment()
See Also:
setComment(java.lang.String)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String getDomain()
See Also:
setDomain(java.lang.String)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int getMaxAge()
See Also:
setMaxAge(int)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[1061]Retrieving all cookies
By Anonymous on 2004/10/20 10:58:30  Rate
// Retrieving all cookies           
 Cookie cookies [  ]  = request.getCookies (  ) ;        
 if  ( cookies != null )        
  {         
   for ( int i=0, n=cookies.length; i  <  n; i++ )             
    {              
     Cookie ckie = cookies [ i ] ;       
     String ckieName = ckie.getName (  ) ;   
     System.out.println ( "COOKIE [ "+i+" ]  Name = "+ckie.getName (  ) +" , Age ="+ckie.getMaxAge (  )  ) ; 
        
     if  ( ckieName.equals ( "JSESSIONID" )  ) ; 
      {  
       ckie.setMaxAge ( 0 ) ; 
       ckie.setPath (  "/"  ) ;  
       response.addCookie ( ckie ) ; 
       session.invalidate (  ) ; 
       response.sendRedirect ( "drrHome.jsp" ) ; 
  
  
      }  
    }  
    
  } 


public String getName()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String getPath()
See Also:
setPath(java.lang.String)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public boolean getSecure()
See Also:
setSecure(boolean)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public String getValue()
See Also:
Cookie, setValue(java.lang.String)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public int getVersion()
See Also:
setVersion(int)
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setComment(String purpose)
See Also:
getComment()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setDomain(String pattern)
See Also:
getDomain()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setMaxAge(int expiry)
See Also:
getMaxAge()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setPath(String uri)
See Also:
getPath()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setSecure(boolean flag)
See Also:
getSecure()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setValue(String newValue)
See Also:
Cookie, getValue()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public void setVersion(int v)
See Also:
getVersion()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags