KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > javacoding > jspider > api > model > Cookie


1 package net.javacoding.jspider.api.model;
2
3 /**
4  * $Id: Cookie.java,v 1.1 2003/03/08 19:52:02 vanrogu Exp $
5  * @todo improve Cookie support: use domain, path and expires
6  */

7 public class Cookie {
8
9     protected String JavaDoc name;
10     protected String JavaDoc value;
11     protected String JavaDoc domain;
12     protected String JavaDoc path;
13     protected String JavaDoc expires;
14
15     public Cookie(String JavaDoc name, String JavaDoc value) {
16         this.name = name;
17         this.value = value;
18     }
19
20     public Cookie(String JavaDoc name, String JavaDoc value, String JavaDoc domain, String JavaDoc path, String JavaDoc expires) {
21         this(name, value);
22         this.domain = domain;
23         this.path = path;
24         this.expires = expires;
25     }
26
27     public String JavaDoc getName() {
28         return name;
29     }
30
31     public String JavaDoc getValue() {
32         return value;
33     }
34
35     public String JavaDoc getDomain ( ) {
36         return domain;
37     }
38
39     public String JavaDoc getPath ( ) {
40         return path;
41     }
42
43     public String JavaDoc getExpires ( ) {
44         return expires;
45     }
46
47     public boolean equals(Object JavaDoc other) {
48         if (other instanceof Cookie) {
49             Cookie otherCookie = (Cookie) other;
50             if (otherCookie.name.equals(this.name)) {
51                 return true;
52             } else {
53                 return false;
54             }
55         } else {
56             return false;
57         }
58     }
59
60     public int hashCode() {
61         return name.hashCode();
62     }
63 }
64
Popular Tags