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 java.lang.String |
SEC_WEBSOCKET_ACCEPT |
static java.lang.String |
SEC_WEBSOCKET_EXTENSIONS |
static java.lang.String |
SEC_WEBSOCKET_KEY |
static java.lang.String |
SEC_WEBSOCKET_PROTOCOL |
static java.lang.String |
SEC_WEBSOCKET_VERSION |
ACCEPT, ACCEPT_CHARSET, ACCEPT_ENCODING, ACCEPT_LANGUAGE, ACCEPT_RANGES, ACCESS_CONTROL_ALLOW_CREDENTIALS, ACCESS_CONTROL_ALLOW_HEADERS, ACCESS_CONTROL_ALLOW_METHODS, ACCESS_CONTROL_ALLOW_ORIGIN, ACCESS_CONTROL_EXPOSE_HEADERS, ACCESS_CONTROL_MAX_AGE, ACCESS_CONTROL_REQUEST_HEADERS, ACCESS_CONTROL_REQUEST_METHOD, AGE, ALLOW, AUTHORIZATION, CACHE_CONTROL, CONNECTION, CONTENT_DISPOSITION, CONTENT_ENCODING, CONTENT_LANGUAGE, CONTENT_LENGTH, CONTENT_LOCATION, CONTENT_RANGE, CONTENT_TYPE, COOKIE, DATE, EMPTY, ETAG, EXPECT, EXPIRES, FROM, HOST, IF_MATCH, IF_MODIFIED_SINCE, IF_NONE_MATCH, IF_RANGE, IF_UNMODIFIED_SINCE, LAST_MODIFIED, LINK, LOCATION, MAX_FORWARDS, ORIGIN, PRAGMA, PROXY_AUTHENTICATE, PROXY_AUTHORIZATION, RANGE, REFERER, RETRY_AFTER, SERVER, SET_COOKIE, SET_COOKIE2, TE, TRAILER, TRANSFER_ENCODING, UPGRADE, USER_AGENT, VARY, VIA, WARNING, WWW_AUTHENTICATE
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(java.lang.String headerName,
java.lang.String headerValue)
Add the given, single header value under the given name.
|
void |
clear() |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
java.util.Set<java.util.Map.Entry<java.lang.String,java.util.List<java.lang.String>>> |
entrySet() |
boolean |
equals(java.lang.Object other) |
java.util.List<java.lang.String> |
get(java.lang.Object key) |
java.lang.String |
getFirst(java.lang.String headerName)
Return the first header value for the given header name, if any.
|
java.lang.String |
getSecWebSocketAccept()
Returns the value of the
Sec-WebSocket-Accept header. |
java.util.List<WebSocketExtension> |
getSecWebSocketExtensions()
Returns the value of the
Sec-WebSocket-Extensions header. |
java.lang.String |
getSecWebSocketKey()
Returns the value of the
Sec-WebSocket-Key header. |
java.util.List<java.lang.String> |
getSecWebSocketProtocol()
Returns the value of the
Sec-WebSocket-Key header. |
java.lang.String |
getSecWebSocketVersion()
Returns the value of the
Sec-WebSocket-Version header. |
int |
hashCode() |
boolean |
isEmpty() |
java.util.Set<java.lang.String> |
keySet() |
java.util.List<java.lang.String> |
put(java.lang.String key,
java.util.List<java.lang.String> value) |
void |
putAll(java.util.Map<? extends java.lang.String,? extends java.util.List<java.lang.String>> m) |
static WebSocketHttpHeaders |
readOnlyWebSocketHttpHeaders(WebSocketHttpHeaders headers)
Returns
WebSocketHttpHeaders object that can only be read, not written to. |
java.util.List<java.lang.String> |
remove(java.lang.Object key) |
void |
set(java.lang.String headerName,
java.lang.String headerValue)
Set the given, single header value under the given name.
|
void |
setAll(java.util.Map<java.lang.String,java.lang.String> values)
Set the given values under.
|
void |
setSecWebSocketAccept(java.lang.String secWebSocketAccept)
Sets the (new) value of the
Sec-WebSocket-Accept header. |
void |
setSecWebSocketExtensions(java.util.List<WebSocketExtension> extensions)
Sets the (new) value(s) of the
Sec-WebSocket-Extensions header. |
void |
setSecWebSocketKey(java.lang.String secWebSocketKey)
Sets the (new) value of the
Sec-WebSocket-Key header. |
void |
setSecWebSocketProtocol(java.util.List<java.lang.String> secWebSocketProtocols)
Sets the (new) value of the
Sec-WebSocket-Protocol header. |
void |
setSecWebSocketProtocol(java.lang.String secWebSocketProtocol)
Sets the (new) value of the
Sec-WebSocket-Protocol header. |
void |
setSecWebSocketVersion(java.lang.String secWebSocketVersion)
Sets the (new) value of the
Sec-WebSocket-Version header. |
int |
size() |
java.util.Map<java.lang.String,java.lang.String> |
toSingleValueMap()
Returns the first values contained in this
MultiValueMap . |
java.lang.String |
toString() |
java.util.Collection<java.util.List<java.lang.String>> |
values() |
addAll, addAll, getAccept, getAcceptCharset, getAcceptLanguage, getAcceptLanguageAsLocales, getAccessControlAllowCredentials, getAccessControlAllowHeaders, getAccessControlAllowMethods, getAccessControlAllowOrigin, getAccessControlExposeHeaders, getAccessControlMaxAge, getAccessControlRequestHeaders, getAccessControlRequestMethod, getAllow, getCacheControl, getConnection, getContentDisposition, getContentLanguage, getContentLength, getContentType, getDate, getETag, getETagValuesAsList, getExpires, getFieldValues, getFirstDate, getFirstZonedDateTime, getHost, getIfMatch, getIfModifiedSince, getIfNoneMatch, getIfUnmodifiedSince, getLastModified, getLocation, getOrigin, getPragma, getRange, getUpgrade, getValuesAsList, getVary, readOnlyHttpHeaders, setAccept, setAcceptCharset, setAcceptLanguage, setAcceptLanguageAsLocales, setAccessControlAllowCredentials, setAccessControlAllowHeaders, setAccessControlAllowMethods, setAccessControlAllowOrigin, setAccessControlExposeHeaders, setAccessControlMaxAge, setAccessControlRequestHeaders, setAccessControlRequestMethod, setAllow, setBasicAuth, setBasicAuth, setBearerAuth, setCacheControl, setCacheControl, setConnection, setConnection, setContentDisposition, setContentDispositionFormData, setContentLanguage, setContentLength, setContentType, setDate, setDate, setETag, setExpires, setExpires, setHost, setIfMatch, setIfMatch, setIfModifiedSince, setIfNoneMatch, setIfNoneMatch, setIfUnmodifiedSince, setLastModified, setLocation, setOrigin, setPragma, setRange, setUpgrade, setVary, setZonedDateTime, toCommaDelimitedString
public static final java.lang.String SEC_WEBSOCKET_ACCEPT
public static final java.lang.String SEC_WEBSOCKET_EXTENSIONS
public static final java.lang.String SEC_WEBSOCKET_KEY
public static final java.lang.String SEC_WEBSOCKET_PROTOCOL
public static final java.lang.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(@Nullable java.lang.String secWebSocketAccept)
Sec-WebSocket-Accept
header.secWebSocketAccept
- the value of the header@Nullable public java.lang.String getSecWebSocketAccept()
Sec-WebSocket-Accept
header.public java.util.List<WebSocketExtension> getSecWebSocketExtensions()
Sec-WebSocket-Extensions
header.public void setSecWebSocketExtensions(java.util.List<WebSocketExtension> extensions)
Sec-WebSocket-Extensions
header.extensions
- the values for the headerpublic void setSecWebSocketKey(@Nullable java.lang.String secWebSocketKey)
Sec-WebSocket-Key
header.secWebSocketKey
- the value of the header@Nullable public java.lang.String getSecWebSocketKey()
Sec-WebSocket-Key
header.public void setSecWebSocketProtocol(java.lang.String secWebSocketProtocol)
Sec-WebSocket-Protocol
header.secWebSocketProtocol
- the value of the headerpublic void setSecWebSocketProtocol(java.util.List<java.lang.String> secWebSocketProtocols)
Sec-WebSocket-Protocol
header.secWebSocketProtocols
- the value of the headerpublic java.util.List<java.lang.String> getSecWebSocketProtocol()
Sec-WebSocket-Key
header.public void setSecWebSocketVersion(@Nullable java.lang.String secWebSocketVersion)
Sec-WebSocket-Version
header.secWebSocketVersion
- the value of the header@Nullable public java.lang.String getSecWebSocketVersion()
Sec-WebSocket-Version
header.@Nullable public java.lang.String getFirst(java.lang.String headerName)
getFirst
in interface MultiValueMap<java.lang.String,java.lang.String>
getFirst
in class HttpHeaders
headerName
- the header namenull
public void add(java.lang.String headerName, @Nullable java.lang.String headerValue)
add
in interface MultiValueMap<java.lang.String,java.lang.String>
add
in class HttpHeaders
headerName
- the header nameheaderValue
- the header valuejava.lang.UnsupportedOperationException
- if adding headers is not supportedput(String, List)
,
set(String, String)
public void set(java.lang.String headerName, @Nullable java.lang.String headerValue)
set
in interface MultiValueMap<java.lang.String,java.lang.String>
set
in class HttpHeaders
headerName
- the header nameheaderValue
- the header valuejava.lang.UnsupportedOperationException
- if adding headers is not supportedput(String, List)
,
add(String, String)
public void setAll(java.util.Map<java.lang.String,java.lang.String> values)
MultiValueMap
setAll
in interface MultiValueMap<java.lang.String,java.lang.String>
setAll
in class HttpHeaders
values
- the values.public java.util.Map<java.lang.String,java.lang.String> toSingleValueMap()
MultiValueMap
MultiValueMap
.toSingleValueMap
in interface MultiValueMap<java.lang.String,java.lang.String>
toSingleValueMap
in class HttpHeaders
public int size()
size
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
size
in class HttpHeaders
public boolean isEmpty()
isEmpty
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
isEmpty
in class HttpHeaders
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
containsKey
in class HttpHeaders
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
containsValue
in class HttpHeaders
public java.util.List<java.lang.String> get(java.lang.Object key)
get
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
get
in class HttpHeaders
public java.util.List<java.lang.String> put(java.lang.String key, java.util.List<java.lang.String> value)
put
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
put
in class HttpHeaders
public java.util.List<java.lang.String> remove(java.lang.Object key)
remove
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
remove
in class HttpHeaders
public void putAll(java.util.Map<? extends java.lang.String,? extends java.util.List<java.lang.String>> m)
putAll
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
putAll
in class HttpHeaders
public void clear()
clear
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
clear
in class HttpHeaders
public java.util.Set<java.lang.String> keySet()
keySet
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
keySet
in class HttpHeaders
public java.util.Collection<java.util.List<java.lang.String>> values()
values
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
values
in class HttpHeaders
public java.util.Set<java.util.Map.Entry<java.lang.String,java.util.List<java.lang.String>>> entrySet()
entrySet
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
entrySet
in class HttpHeaders
public boolean equals(java.lang.Object other)
equals
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
equals
in class HttpHeaders
public int hashCode()
hashCode
in interface java.util.Map<java.lang.String,java.util.List<java.lang.String>>
hashCode
in class HttpHeaders
public java.lang.String toString()
toString
in class HttpHeaders