@@ -175,12 +175,13 @@ public interface HttpServletResponse extends ServletResponse {
175
175
public void sendRedirect (String location ) throws IOException ;
176
176
177
177
/**
178
- *
179
178
* Sets a response header with the given name and date-value. The date is specified in terms of milliseconds since the
180
- * epoch. If the header had already been set, the new value overwrites the previous one . The <code>containsHeader</code>
181
- * method can be used to test for the presence of a header before setting its value.
179
+ * epoch. If the header had already been set, the new value overwrites all previous values . The
180
+ * <code>containsHeader</code> method can be used to test for the presence of a header before setting its value.
182
181
* <p>
183
182
* This method has no effect if called after the response has been committed.
183
+ * <p>
184
+ * This method has no effect if {@code null} is passed for the {@code name} parameter.
184
185
*
185
186
* @param name the name of the header to set
186
187
* @param date the assigned date value
@@ -191,11 +192,12 @@ public interface HttpServletResponse extends ServletResponse {
191
192
public void setDateHeader (String name , long date );
192
193
193
194
/**
194
- *
195
195
* Adds a response header with the given name and date-value. The date is specified in terms of milliseconds since the
196
196
* epoch. This method allows response headers to have multiple values.
197
197
* <p>
198
198
* This method has no effect if called after the response has been committed.
199
+ * <p>
200
+ * This method has no effect if {@code null} is passed for the {@code name} parameter.
199
201
*
200
202
* @param name the name of the header to set
201
203
* @param date the additional date value
@@ -205,12 +207,17 @@ public interface HttpServletResponse extends ServletResponse {
205
207
public void addDateHeader (String name , long date );
206
208
207
209
/**
208
- *
209
210
* Sets a response header with the given name and value. If the header had already been set, the new value overwrites
210
- * the previous one . The <code>containsHeader</code> method can be used to test for the presence of a header before
211
+ * all previous values . The <code>containsHeader</code> method can be used to test for the presence of a header before
211
212
* setting its value.
212
213
* <p>
213
214
* This method has no effect if called after the response has been committed.
215
+ * <p>
216
+ * This method has no effect if {@code null} is passed for the {@code name} parameter.
217
+ * <p>
218
+ * Passing {@code null} as the value removes all headers with the given name.
219
+ * <p>
220
+ * Note that the empty string is a valid header value.
214
221
*
215
222
* @param name the name of the header
216
223
* @param value the header value If it contains octet string, it should be encoded according to RFC 2047
@@ -223,6 +230,12 @@ public interface HttpServletResponse extends ServletResponse {
223
230
224
231
/**
225
232
* Adds a response header with the given name and value. This method allows response headers to have multiple values.
233
+ * <p>
234
+ * This method has no effect if called after the response has been committed.
235
+ * <p>
236
+ * This method has no effect if {@code null} is passed for either the {@code name} or {@code value} parameters.
237
+ * <p>
238
+ * Note that the empty string is a valid header value.
226
239
*
227
240
* @param name the name of the header
228
241
* @param value the additional header value If it contains octet string, it should be encoded according to RFC 2047
@@ -234,10 +247,12 @@ public interface HttpServletResponse extends ServletResponse {
234
247
235
248
/**
236
249
* Sets a response header with the given name and integer value. If the header had already been set, the new value
237
- * overwrites the previous one . The <code>containsHeader</code> method can be used to test for the presence of a header
238
- * before setting its value.
250
+ * overwrites all previous values . The <code>containsHeader</code> method can be used to test for the presence of a
251
+ * header before setting its value.
239
252
* <p>
240
253
* This method has no effect if called after the response has been committed.
254
+ * <p>
255
+ * This method has no effect if {@code null} is passed for the {@code name} parameter.
241
256
*
242
257
* @param name the name of the header
243
258
* @param value the assigned integer value
@@ -252,6 +267,8 @@ public interface HttpServletResponse extends ServletResponse {
252
267
* values.
253
268
* <p>
254
269
* This method has no effect if called after the response has been committed.
270
+ * <p>
271
+ * This method has no effect if {@code null} is passed for the {@code name} parameter.
255
272
*
256
273
* @param name the name of the header
257
274
* @param value the assigned integer value
0 commit comments