23 * questions.
24 */
25
26 package com.sun.net.httpserver;
27
28 import java.util.*;
29
30 /**
31 * HTTP request and response headers are represented by this class which implements
32 * the interface {@link java.util.Map}<
33 * {@link java.lang.String},{@link java.util.List}<{@link java.lang.String}>>.
34 * The keys are case-insensitive Strings representing the header names and
35 * the value associated with each key is a {@link List}<{@link String}> with one
36 * element for each occurrence of the header name in the request or response.
37 * <p>
38 * For example, if a response header instance contains one key "HeaderName" with two values "value1 and value2"
39 * then this object is output as two header lines:
40 * <blockquote><pre>
41 * HeaderName: value1
42 * HeaderName: value2
43 * </blockquote></pre>
44 * <p>
45 * All the normal {@link java.util.Map} methods are provided, but the following
46 * additional convenience methods are most likely to be used:
47 * <ul>
48 * <li>{@link #getFirst(String)} returns a single valued header or the first value of
49 * a multi-valued header.</li>
50 * <li>{@link #add(String,String)} adds the given header value to the list for the given key</li>
51 * <li>{@link #set(String,String)} sets the given header field to the single value given
52 * overwriting any existing values in the value list.
53 * </ul><p>
54 * All methods in this class accept <code>null</code> values for keys and values. However, null
55 * keys will never will be present in HTTP request headers, and will not be output/sent in response headers.
56 * Null values can be represented as either a null entry for the key (i.e. the list is null) or
57 * where the key has a list, but one (or more) of the list's values is null. Null values are output
58 * as a header line containing the key but no associated value.
59 * @since 1.6
60 */
61 @jdk.Exported
62 public class Headers implements Map<String,List<String>> {
63
|
23 * questions.
24 */
25
26 package com.sun.net.httpserver;
27
28 import java.util.*;
29
30 /**
31 * HTTP request and response headers are represented by this class which implements
32 * the interface {@link java.util.Map}<
33 * {@link java.lang.String},{@link java.util.List}<{@link java.lang.String}>>.
34 * The keys are case-insensitive Strings representing the header names and
35 * the value associated with each key is a {@link List}<{@link String}> with one
36 * element for each occurrence of the header name in the request or response.
37 * <p>
38 * For example, if a response header instance contains one key "HeaderName" with two values "value1 and value2"
39 * then this object is output as two header lines:
40 * <blockquote><pre>
41 * HeaderName: value1
42 * HeaderName: value2
43 * </pre></blockquote>
44 * <p>
45 * All the normal {@link java.util.Map} methods are provided, but the following
46 * additional convenience methods are most likely to be used:
47 * <ul>
48 * <li>{@link #getFirst(String)} returns a single valued header or the first value of
49 * a multi-valued header.</li>
50 * <li>{@link #add(String,String)} adds the given header value to the list for the given key</li>
51 * <li>{@link #set(String,String)} sets the given header field to the single value given
52 * overwriting any existing values in the value list.
53 * </ul><p>
54 * All methods in this class accept <code>null</code> values for keys and values. However, null
55 * keys will never will be present in HTTP request headers, and will not be output/sent in response headers.
56 * Null values can be represented as either a null entry for the key (i.e. the list is null) or
57 * where the key has a list, but one (or more) of the list's values is null. Null values are output
58 * as a header line containing the key but no associated value.
59 * @since 1.6
60 */
61 @jdk.Exported
62 public class Headers implements Map<String,List<String>> {
63
|