001: // HttpCookie.java
002: // $Id: HttpCookie.java,v 1.7 2000/08/16 21:37:59 ylafon Exp $
003: // (c) COPYRIGHT MIT and INRIA, 1996.
004: // Please first read the full copyright statement in file COPYRIGHT.html
005:
006: package org.w3c.www.http;
007:
008: public class HttpCookie {
009: /**
010: * The path in which this cookie applies.
011: */
012: protected String path = null;
013: /**
014: * The domain in which this cookie applies.
015: */
016: protected String domain = null;
017: /**
018: * This cookie's value.
019: */
020: protected String value = null;
021: /**
022: * This cookie's name.
023: */
024: protected String name = null;
025: /**
026: * Set this cookie's version.
027: */
028: protected int version = 1;
029: /**
030: * Set the security flag
031: */
032: protected boolean secure = false;
033:
034: /**
035: * Get the security flag
036: * @return true if it's a secured cookie
037: */
038: public boolean getSecurity() {
039: return secure;
040: }
041:
042: public void setSecurity(boolean secure) {
043: this .secure = secure;
044: }
045:
046: /**
047: * Get the path to which this cookie applies.
048: * @return The path encoded as a String, or <strong>null</strong> if not
049: * defined.
050: */
051:
052: public String getPath() {
053: return path;
054: }
055:
056: /**
057: * Set the path in which this cookie applies.
058: * @param path The path to which this cookie applies, or <strong>null
059: * </strong> to reset it.
060: */
061:
062: public void setPath(String path) {
063: this .path = path;
064: }
065:
066: /**
067: * Get the domain in which this cookie applies.
068: * @return The domain in which this cookie applies, encoded as a String,
069: * or <strong>null</strong> if undefined.
070: */
071:
072: public String getDomain() {
073: return domain;
074: }
075:
076: /**
077: * Set the domain in which this cookie applies.
078: * @param domain The domain in which the cookie applies, or <strong>
079: * null</strong> to reset it.
080: */
081:
082: public void setDomain(String domain) {
083: this .domain = domain;
084: }
085:
086: /**
087: * Get this cookie's version.
088: * @return An integer, giving the cookie's version.
089: */
090:
091: public int getVersion() {
092: return version;
093: }
094:
095: /**
096: * Set this cookie's version.
097: * @param version An integer indicating the version of this cookie.
098: */
099:
100: public void setVersion(int version) {
101: this .version = version;
102: }
103:
104: /**
105: * Get this cookie's name.
106: * @return The name of the cookie, or <strong>null</strong> if undefined.
107: */
108:
109: public String getName() {
110: return name;
111: }
112:
113: /**
114: * Set this cookie's name.
115: * @param name The cookie's name, or <strong>null</strong> to reset the
116: * value.
117: */
118:
119: public void setName(String name) {
120: this .name = name;
121: }
122:
123: /**
124: * Get this cookie's value.
125: * @return The value, encoded as a String, or <strong>nullM</strong> if
126: * no value defined.
127: */
128:
129: public String getValue() {
130: return value;
131: }
132:
133: /**
134: * Set this cookie's value.
135: * @param value The String encoded value, or <strong>null</strong> to
136: * reset the value.
137: */
138:
139: public void setValue(String value) {
140: this .value = value;
141: }
142:
143: public String toString() {
144: return name + "=" + value;
145: }
146:
147: HttpCookie(boolean isValid, String name, String value) {
148: this .name = name;
149: this .value = value;
150: }
151:
152: public HttpCookie() {
153: }
154:
155: }
|