Package org.astrogrid.samp.httpd
Class HttpServer.HttpHeaderMap
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- java.util.LinkedHashMap
-
- org.astrogrid.samp.httpd.HttpServer.HttpHeaderMap
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.util.Map
- Enclosing class:
- HttpServer
static class HttpServer.HttpHeaderMap extends java.util.LinkedHashMap
Map implementation suitable for storing HTTP headers. It should be populated using theaddHeader(java.lang.String, java.lang.String)
, notHashMap.put(K, V)
, method. This implementation should be used when a header is being constructed from an uncontrolled source of (key,value) pairs. If you are adding headers yourself and know that you won't duplicate keys, then a normal Map implementation will do.
-
-
Constructor Summary
Constructors Constructor Description HttpHeaderMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addHeader(java.lang.String key, java.lang.String value)
Adds a header value to this map.-
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values
-
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
-
-
-
-
Method Detail
-
addHeader
public void addHeader(java.lang.String key, java.lang.String value)
Adds a header value to this map. This differs from put in two subtle ways. First, key matching is case-insensitive. Second, if a value for the given key already exists, the new value will be appended after a comma, rather than replacing the old entry. See RFC2616 section 4.2 for the HTTP rules.- Parameters:
key
- header namevalue
- header value
-
-