public class WebSocketHttpHeaders extends HttpHeaders
HttpHeaders
variant that adds support for
the HTTP headers defined by the WebSocket specification RFC 6455.Modifier and Type | Field and Description |
---|---|
static String |
SEC_WEBSOCKET_ACCEPT |
static String |
SEC_WEBSOCKET_EXTENSIONS |
static String |
SEC_WEBSOCKET_KEY |
static String |
SEC_WEBSOCKET_PROTOCOL |
static String |
SEC_WEBSOCKET_VERSION |
Constructor and Description |
---|
WebSocketHttpHeaders()
Create a new instance.
|
WebSocketHttpHeaders(HttpHeaders headers)
Create an instance that wraps the given pre-existing HttpHeaders and also
propagate all changes to it.
|
Modifier and Type | Method and Description |
---|---|
void |
add(String headerName,
String headerValue)
Add the given, single header value under the given name.
|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<String,List<String>>> |
entrySet() |
boolean |
equals(Object other) |
List<String> |
get(Object key) |
String |
getFirst(String headerName)
Return the first header value for the given header name, if any.
|
String |
getSecWebSocketAccept()
Returns the value of the
Sec-WebSocket-Accept header. |
List<WebSocketExtension> |
getSecWebSocketExtensions()
Returns the value of the
Sec-WebSocket-Extensions header. |
String |
getSecWebSocketKey()
Returns the value of the
Sec-WebSocket-Key header. |
List<String> |
getSecWebSocketProtocol()
Returns the value of the
Sec-WebSocket-Key header. |
String |
getSecWebSocketVersion()
Returns the value of the
Sec-WebSocket-Version header. |
int |
hashCode() |
boolean |
isEmpty() |
Set<String> |
keySet() |
List<String> |
put(String key,
List<String> value) |
void |
putAll(Map<? extends String,? extends List<String>> m) |
static WebSocketHttpHeaders |
readOnlyWebSocketHttpHeaders(WebSocketHttpHeaders headers)
Returns
WebSocketHttpHeaders object that can only be read, not written to. |
List<String> |
remove(Object key) |
void |
set(String headerName,
String headerValue)
Set the given, single header value under the given name.
|
void |
setAll(Map<String,String> values)
Set the given values under.
|
void |
setSecWebSocketAccept(String secWebSocketAccept)
Sets the (new) value of the
Sec-WebSocket-Accept header. |
void |
setSecWebSocketExtensions(List<WebSocketExtension> extensions)
Sets the (new) value(s) of the
Sec-WebSocket-Extensions header. |
void |
setSecWebSocketKey(String secWebSocketKey)
Sets the (new) value of the
Sec-WebSocket-Key header. |
void |
setSecWebSocketProtocol(List<String> secWebSocketProtocols)
Sets the (new) value of the
Sec-WebSocket-Protocol header. |
void |
setSecWebSocketProtocol(String secWebSocketProtocol)
Sets the (new) value of the
Sec-WebSocket-Protocol header. |
void |
setSecWebSocketVersion(String secWebSocketVersion)
Sets the (new) value of the
Sec-WebSocket-Version header. |
int |
size() |
Map<String,String> |
toSingleValueMap()
Returns the first values contained in this
MultiValueMap . |
String |
toString() |
Collection<List<String>> |
values() |
getAccept, getAcceptCharset, getAllow, getCacheControl, getConnection, getContentLength, getContentType, getDate, getETag, getExpires, getFirstDate, getFirstValueAsList, getIfModifiedSince, getIfNoneMatch, getIfNotModifiedSince, getLastModified, getLocation, getOrigin, getPragma, getUpgrade, readOnlyHttpHeaders, setAccept, setAcceptCharset, setAllow, setCacheControl, setConnection, setConnection, setContentDispositionFormData, setContentLength, setContentType, setDate, setDate, setETag, setExpires, setIfModifiedSince, setIfNoneMatch, setIfNoneMatch, setLastModified, setLocation, setOrigin, setPragma, setUpgrade, toCommaDelimitedString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
public static final String SEC_WEBSOCKET_ACCEPT
public static final String SEC_WEBSOCKET_EXTENSIONS
public static final String SEC_WEBSOCKET_KEY
public static final String SEC_WEBSOCKET_PROTOCOL
public static final String SEC_WEBSOCKET_VERSION
public WebSocketHttpHeaders()
public WebSocketHttpHeaders(HttpHeaders headers)
headers
- the HTTP headers to wrappublic static WebSocketHttpHeaders readOnlyWebSocketHttpHeaders(WebSocketHttpHeaders headers)
WebSocketHttpHeaders
object that can only be read, not written to.public void setSecWebSocketAccept(String secWebSocketAccept)
Sec-WebSocket-Accept
header.secWebSocketAccept
- the value of the headerpublic String getSecWebSocketAccept()
Sec-WebSocket-Accept
header.public List<WebSocketExtension> getSecWebSocketExtensions()
Sec-WebSocket-Extensions
header.public void setSecWebSocketExtensions(List<WebSocketExtension> extensions)
Sec-WebSocket-Extensions
header.extensions
- the values for the headerpublic void setSecWebSocketKey(String secWebSocketKey)
Sec-WebSocket-Key
header.secWebSocketKey
- the value of the headerpublic String getSecWebSocketKey()
Sec-WebSocket-Key
header.public void setSecWebSocketProtocol(String secWebSocketProtocol)
Sec-WebSocket-Protocol
header.secWebSocketProtocol
- the value of the headerpublic void setSecWebSocketProtocol(List<String> secWebSocketProtocols)
Sec-WebSocket-Protocol
header.secWebSocketProtocols
- the value of the headerpublic List<String> getSecWebSocketProtocol()
Sec-WebSocket-Key
header.public void setSecWebSocketVersion(String secWebSocketVersion)
Sec-WebSocket-Version
header.secWebSocketVersion
- the value of the headerpublic String getSecWebSocketVersion()
Sec-WebSocket-Version
header.public String getFirst(String headerName)
getFirst
in interface MultiValueMap<String,String>
getFirst
in class HttpHeaders
headerName
- the header namenull
public void add(String headerName, String headerValue)
add
in interface MultiValueMap<String,String>
add
in class HttpHeaders
headerName
- the header nameheaderValue
- the header valueUnsupportedOperationException
- if adding headers is not supportedput(String, List)
,
set(String, String)
public void set(String headerName, String headerValue)
set
in interface MultiValueMap<String,String>
set
in class HttpHeaders
headerName
- the header nameheaderValue
- the header valueUnsupportedOperationException
- if adding headers is not supportedput(String, List)
,
add(String, String)
public void setAll(Map<String,String> values)
MultiValueMap
setAll
in interface MultiValueMap<String,String>
setAll
in class HttpHeaders
values
- the values.public Map<String,String> toSingleValueMap()
MultiValueMap
MultiValueMap
.toSingleValueMap
in interface MultiValueMap<String,String>
toSingleValueMap
in class HttpHeaders
public int size()
public boolean isEmpty()
public boolean containsKey(Object key)
containsKey
in interface Map<String,List<String>>
containsKey
in class HttpHeaders
public boolean containsValue(Object value)
containsValue
in interface Map<String,List<String>>
containsValue
in class HttpHeaders
public void clear()
public Collection<List<String>> values()
public boolean equals(Object other)
public int hashCode()
public String toString()
toString
in class HttpHeaders