Java Doc for Cookie.java in  » Net » Apache-common-HttpClient » org » apache » commons » httpclient » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » Apache common HttpClient » org.apache.commons.httpclient 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.httpclient.NameValuePair
      org.apache.commons.httpclient.Cookie

All known Subclasses:   org.apache.commons.httpclient.cookie.Cookie2,
Cookie
public class Cookie extends NameValuePair implements Serializable,Comparator(Code)

HTTP "magic-cookie" represents a piece of state information that the HTTP agent and the target server can exchange to maintain a session.


author:
   B.C. Holmes
author:
   Park, Sung-Gu
author:
   Doug Sale
author:
   Rod Waldhoff
author:
   dIon Gillard
author:
   Sean C. Sullivan
author:
   John Evans
author:
   Marc A. Saegesser
author:
   Oleg Kalnichevski
author:
   Mike Bowler
version:
   $Revision: 531354 $ $Date: 2007-04-23 08:53:20 +0200 (Mon, 23 Apr 2007) $



Constructor Summary
public  Cookie()
     Default constructor.
public  Cookie(String domain, String name, String value)
     Creates a cookie with the given name, value and domain attribute.
public  Cookie(String domain, String name, String value, String path, Date expires, boolean secure)
    
public  Cookie(String domain, String name, String value, String path, int maxAge, boolean secure)
     Creates a cookie with the given name, value, domain attribute, path attribute, maximum age attribute, and secure attribute
Parameters:
  name - the cookie name
Parameters:
  value - the cookie value
Parameters:
  domain - the domain this cookie can be sent to
Parameters:
  path - the path prefix for which this cookie can be sent
Parameters:
  maxAge - the number of seconds for which this cookie is valid.maxAge is expected to be a non-negative number.

Method Summary
public  intcompare(Object o1, Object o2)
    

Compares two cookies to determine order for cookie header.

Most specific should be first.

public  booleanequals(Object obj)
     Two cookies are equal if the name, path and domain match.
Parameters:
  obj - The object to compare against.
public  StringgetComment()
     Returns the comment describing the purpose of this cookie, or null if no such comment has been defined.
public  StringgetDomain()
     Returns domain attribute of the cookie.
public  DategetExpiryDate()
     Returns the expiration Date of the cookie, or null if none exists.

Note: the object returned by this method is considered immutable.

public  StringgetPath()
    
public  booleangetSecure()
    
public  intgetVersion()
     Returns the version of the cookie specification to which this cookie conforms.
public  inthashCode()
     Returns a hash code in keeping with the Object.hashCode general hashCode contract.
public  booleanisDomainAttributeSpecified()
     Returns true if cookie's domain was set via a domain attribute in the Set-Cookie header.
public  booleanisExpired()
     Returns true if this cookie has expired.
public  booleanisExpired(Date now)
     Returns true if this cookie has expired according to the time passed in.
Parameters:
  now - The current time.
public  booleanisPathAttributeSpecified()
     Returns true if cookie's path was set via a path attribute in the Set-Cookie header.
public  booleanisPersistent()
     Returns false if the cookie should be discarded at the end of the "session"; true otherwise.
public  voidsetComment(String comment)
     If a user agent (web browser) presents this cookie to a user, the cookie's purpose will be described using this comment.
public  voidsetDomain(String domain)
     Sets the domain attribute.
public  voidsetDomainAttributeSpecified(boolean value)
     Indicates whether the cookie had a domain specified in a domain attribute of the Set-Cookie header.
public  voidsetExpiryDate(Date expiryDate)
     Sets expiration date.

Note: the object returned by this method is considered immutable.

public  voidsetPath(String path)
     Sets the path attribute.
public  voidsetPathAttributeSpecified(boolean value)
     Indicates whether the cookie had a path specified in a path attribute of the Set-Cookie header.
public  voidsetSecure(boolean secure)
     Sets the secure attribute of the cookie.

When true the cookie should only be sent using a secure protocol (https).

public  voidsetVersion(int version)
     Sets the version of the cookie specification to which this cookie conforms.
public  StringtoExternalForm()
     Return a textual representation of the cookie.
public  StringtoString()
     Return a textual representation of the cookie.


Constructor Detail
Cookie
public Cookie()(Code)
Default constructor. Creates a blank cookie



Cookie
public Cookie(String domain, String name, String value)(Code)
Creates a cookie with the given name, value and domain attribute.
Parameters:
  name - the cookie name
Parameters:
  value - the cookie value
Parameters:
  domain - the domain this cookie can be sent to



Cookie
public Cookie(String domain, String name, String value, String path, Date expires, boolean secure)(Code)
Creates a cookie with the given name, value, domain attribute, path attribute, expiration attribute, and secure attribute
Parameters:
  name - the cookie name
Parameters:
  value - the cookie value
Parameters:
  domain - the domain this cookie can be sent to
Parameters:
  path - the path prefix for which this cookie can be sent
Parameters:
  expires - the Date at which this cookie expires,or null if the cookie expires at the endof the session
Parameters:
  secure - if true this cookie can only be sent over secureconnections
throws:
  IllegalArgumentException - If cookie name is null or blank,cookie name contains a blank, or cookie name starts with character $



Cookie
public Cookie(String domain, String name, String value, String path, int maxAge, boolean secure)(Code)
Creates a cookie with the given name, value, domain attribute, path attribute, maximum age attribute, and secure attribute
Parameters:
  name - the cookie name
Parameters:
  value - the cookie value
Parameters:
  domain - the domain this cookie can be sent to
Parameters:
  path - the path prefix for which this cookie can be sent
Parameters:
  maxAge - the number of seconds for which this cookie is valid.maxAge is expected to be a non-negative number. -1 signifies that the cookie should never expire.
Parameters:
  secure - if true this cookie can only be sent over secureconnections




Method Detail
compare
public int compare(Object o1, Object o2)(Code)

Compares two cookies to determine order for cookie header.

Most specific should be first.

This method is implemented so a cookie can be used as a comparator for a SortedSet of cookies. Specifically it's used above in the createCookieHeader method.


Parameters:
  o1 - The first object to be compared
Parameters:
  o2 - The second object to be compared See java.util.Comparator.compare(ObjectObject)



equals
public boolean equals(Object obj)(Code)
Two cookies are equal if the name, path and domain match.
Parameters:
  obj - The object to compare against. true if the two objects are equal.



getComment
public String getComment()(Code)
Returns the comment describing the purpose of this cookie, or null if no such comment has been defined. comment
See Also:   Cookie.setComment(String)



getDomain
public String getDomain()(Code)
Returns domain attribute of the cookie. the value of the domain attribute
See Also:   Cookie.setDomain(java.lang.String)



getExpiryDate
public Date getExpiryDate()(Code)
Returns the expiration Date of the cookie, or null if none exists.

Note: the object returned by this method is considered immutable. Changing it (e.g. using setTime()) could result in undefined behaviour. Do so at your peril.

Expiration Date, or null.
See Also:   Cookie.setExpiryDate(java.util.Date)



getPath
public String getPath()(Code)
Returns the path attribute of the cookie The value of the path attribute.
See Also:   Cookie.setPath(java.lang.String)



getSecure
public boolean getSecure()(Code)
true if this cookie should only be sent over secure connections.
See Also:   Cookie.setSecure(boolean)



getVersion
public int getVersion()(Code)
Returns the version of the cookie specification to which this cookie conforms. the version of the cookie.
See Also:   Cookie.setVersion(int)



hashCode
public int hashCode()(Code)
Returns a hash code in keeping with the Object.hashCode general hashCode contract. A hash code



isDomainAttributeSpecified
public boolean isDomainAttributeSpecified()(Code)
Returns true if cookie's domain was set via a domain attribute in the Set-Cookie header. value true if the cookie's domain was explicitly set, false otherwise.
See Also:   Cookie.setDomainAttributeSpecified



isExpired
public boolean isExpired()(Code)
Returns true if this cookie has expired. true if the cookie has expired.



isExpired
public boolean isExpired(Date now)(Code)
Returns true if this cookie has expired according to the time passed in.
Parameters:
  now - The current time. true if the cookie expired.



isPathAttributeSpecified
public boolean isPathAttributeSpecified()(Code)
Returns true if cookie's path was set via a path attribute in the Set-Cookie header. value true if the cookie's path was explicitly set, false otherwise.
See Also:   Cookie.setPathAttributeSpecified



isPersistent
public boolean isPersistent()(Code)
Returns false if the cookie should be discarded at the end of the "session"; true otherwise. false if the cookie should be discarded at the endof the "session"; true otherwise



setComment
public void setComment(String comment)(Code)
If a user agent (web browser) presents this cookie to a user, the cookie's purpose will be described using this comment.
Parameters:
  comment -
See Also:   Cookie.getComment()



setDomain
public void setDomain(String domain)(Code)
Sets the domain attribute.
Parameters:
  domain - The value of the domain attribute
See Also:   Cookie.getDomain



setDomainAttributeSpecified
public void setDomainAttributeSpecified(boolean value)(Code)
Indicates whether the cookie had a domain specified in a domain attribute of the Set-Cookie header. This value is important for generating the Cookie header because some cookie specifications require that the Cookie header should only include a domain attribute if the cookie's domain was specified in the Set-Cookie header.
Parameters:
  value - true if the cookie's domain was explicitly set, false otherwise.
See Also:   Cookie.isDomainAttributeSpecified



setExpiryDate
public void setExpiryDate(Date expiryDate)(Code)
Sets expiration date.

Note: the object returned by this method is considered immutable. Changing it (e.g. using setTime()) could result in undefined behaviour. Do so at your peril.


Parameters:
  expiryDate - the Date after which this cookie is no longer valid.
See Also:   Cookie.getExpiryDate



setPath
public void setPath(String path)(Code)
Sets the path attribute.
Parameters:
  path - The value of the path attribute
See Also:   Cookie.getPath



setPathAttributeSpecified
public void setPathAttributeSpecified(boolean value)(Code)
Indicates whether the cookie had a path specified in a path attribute of the Set-Cookie header. This value is important for generating the Cookie header because some cookie specifications require that the Cookie header should only include a path attribute if the cookie's path was specified in the Set-Cookie header.
Parameters:
  value - true if the cookie's path was explicitly set, false otherwise.
See Also:   Cookie.isPathAttributeSpecified



setSecure
public void setSecure(boolean secure)(Code)
Sets the secure attribute of the cookie.

When true the cookie should only be sent using a secure protocol (https). This should only be set when the cookie's originating server used a secure protocol to set the cookie's value.
Parameters:
  secure - The value of the secure attribute
See Also:   Cookie.getSecure()




setVersion
public void setVersion(int version)(Code)
Sets the version of the cookie specification to which this cookie conforms.
Parameters:
  version - the version of the cookie.
See Also:   Cookie.getVersion



toExternalForm
public String toExternalForm()(Code)
Return a textual representation of the cookie. string.



toString
public String toString()(Code)
Return a textual representation of the cookie. string.
See Also:   Cookie.toExternalForm



Methods inherited from org.apache.commons.httpclient.NameValuePair
public boolean equals(Object object)(Code)(Java Doc)
public String getName()(Code)(Java Doc)
public String getValue()(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
public void setName(String name)(Code)(Java Doc)
public void setValue(String value)(Code)(Java Doc)
public String toString()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.