1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.netty.handler.codec.http;
17
18 import java.util.Collections;
19 import java.util.Set;
20 import java.util.TreeSet;
21
22
23
24
25
26
27 @Deprecated
28 public class DefaultCookie extends org.jboss.netty.handler.codec.http.cookie.DefaultCookie implements Cookie {
29
30 private String comment;
31 private String commentUrl;
32 private boolean discard;
33 private Set<Integer> ports = Collections.emptySet();
34 private Set<Integer> unmodifiablePorts = ports;
35 private int version;
36
37
38
39
40 public DefaultCookie(String name, String value) {
41 super(name, value);
42 }
43
44 @Deprecated
45 public String getName() {
46 return name();
47 }
48
49 @Deprecated
50 public String getValue() {
51 return value();
52 }
53
54 @Deprecated
55 public String getDomain() {
56 return domain();
57 }
58
59 @Deprecated
60 public String getPath() {
61 return path();
62 }
63
64 @Deprecated
65 public String getComment() {
66 return comment();
67 }
68
69 @Deprecated
70 public String comment() {
71 return comment;
72 }
73
74 @Deprecated
75 public void setComment(String comment) {
76 this.comment = validateValue("comment", comment);
77 }
78
79 @Deprecated
80 public String getCommentUrl() {
81 return commentUrl();
82 }
83
84 @Deprecated
85 public String commentUrl() {
86 return commentUrl;
87 }
88
89 @Deprecated
90 public void setCommentUrl(String commentUrl) {
91 this.commentUrl = validateValue("commentUrl", commentUrl);
92 }
93
94 @Deprecated
95 public boolean isDiscard() {
96 return discard;
97 }
98
99 @Deprecated
100 public void setDiscard(boolean discard) {
101 this.discard = discard;
102 }
103
104 @Deprecated
105 public Set<Integer> getPorts() {
106 return ports();
107 }
108
109 @Deprecated
110 public Set<Integer> ports() {
111 if (unmodifiablePorts == null) {
112 unmodifiablePorts = Collections.unmodifiableSet(ports);
113 }
114 return unmodifiablePorts;
115 }
116
117 @Deprecated
118 public void setPorts(int... ports) {
119 if (ports == null) {
120 throw new NullPointerException("ports");
121 }
122
123 int[] portsCopy = ports.clone();
124 if (portsCopy.length == 0) {
125 unmodifiablePorts = this.ports = Collections.emptySet();
126 } else {
127 Set<Integer> newPorts = new TreeSet<Integer>();
128 for (int p: portsCopy) {
129 if (p <= 0 || p > 65535) {
130 throw new IllegalArgumentException("port out of range: " + p);
131 }
132 newPorts.add(Integer.valueOf(p));
133 }
134 this.ports = newPorts;
135 unmodifiablePorts = null;
136 }
137 }
138
139 @Deprecated
140 public void setPorts(Iterable<Integer> ports) {
141 Set<Integer> newPorts = new TreeSet<Integer>();
142 for (int p: ports) {
143 if (p <= 0 || p > 65535) {
144 throw new IllegalArgumentException("port out of range: " + p);
145 }
146 newPorts.add(Integer.valueOf(p));
147 }
148 if (newPorts.isEmpty()) {
149 unmodifiablePorts = this.ports = Collections.emptySet();
150 } else {
151 this.ports = newPorts;
152 unmodifiablePorts = null;
153 }
154 }
155
156 @Deprecated
157 public int getMaxAge() {
158 return maxAge();
159 }
160
161 @Deprecated
162 public int getVersion() {
163 return version();
164 }
165
166 @Deprecated
167 public int version() {
168 return version;
169 }
170
171 @Deprecated
172 public void setVersion(int version) {
173 this.version = version;
174 }
175 }