Package org.springframework.web.socket
Class WebSocketHttpHeaders
java.lang.Object
org.springframework.http.HttpHeaders
org.springframework.web.socket.WebSocketHttpHeaders
- All Implemented Interfaces:
- Serializable,- Map<String,,- List<String>> - MultiValueMap<String,- String> 
An 
HttpHeaders variant that adds support for
 the HTTP headers defined by the WebSocket specification RFC 6455.- Since:
- 4.0
- Author:
- Rossen Stoyanchev
- See Also:
- 
Nested Class Summary
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class org.springframework.http.HttpHeadersACCEPT, ACCEPT_CHARSET, ACCEPT_ENCODING, ACCEPT_LANGUAGE, ACCEPT_PATCH, 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 SummaryConstructorsConstructorDescriptionCreate a new instance.WebSocketHttpHeaders(HttpHeaders headers) Create an instance that wraps the given pre-existing HttpHeaders and also propagate all changes to it.
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdd the given, single header value under the given name.voidclear()booleancontainsKey(Object key) booleancontainsValue(Object value) entrySet()booleanvoidforEach(BiConsumer<? super String, ? super List<String>> action) Return the first header value for the given header name, if any.Returns the value of theSec-WebSocket-Acceptheader.Returns the value of theSec-WebSocket-Extensionsheader.Returns the value of theSec-WebSocket-Keyheader.Returns the value of theSec-WebSocket-Keyheader.Returns the value of theSec-WebSocket-Versionheader.inthashCode()booleanisEmpty()keySet()voidputIfAbsent(String key, List<String> value) voidSet the given, single header value under the given name.voidSet the given values under.voidsetSecWebSocketAccept(String secWebSocketAccept) Sets the (new) value of theSec-WebSocket-Acceptheader.voidsetSecWebSocketExtensions(List<WebSocketExtension> extensions) Sets the (new) value(s) of theSec-WebSocket-Extensionsheader.voidsetSecWebSocketKey(String secWebSocketKey) Sets the (new) value of theSec-WebSocket-Keyheader.voidsetSecWebSocketProtocol(String secWebSocketProtocol) Sets the (new) value of theSec-WebSocket-Protocolheader.voidsetSecWebSocketProtocol(List<String> secWebSocketProtocols) Sets the (new) value of theSec-WebSocket-Protocolheader.voidsetSecWebSocketVersion(String secWebSocketVersion) Sets the (new) value of theSec-WebSocket-Versionheader.intsize()Return aMapwith the first values contained in thisMultiValueMap.toString()values()Methods inherited from class org.springframework.http.HttpHeadersaddAll, addAll, asSingleValueMap, clearContentHeaders, encodeBasicAuth, formatHeaders, getAccept, getAcceptCharset, getAcceptLanguage, getAcceptLanguageAsLocales, getAcceptPatch, 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, getOrEmpty, getOrigin, getPragma, getRange, getUpgrade, getValuesAsList, getVary, readOnlyHttpHeaders, readOnlyHttpHeaders, setAccept, setAcceptCharset, setAcceptLanguage, setAcceptLanguageAsLocales, setAcceptPatch, setAccessControlAllowCredentials, setAccessControlAllowHeaders, setAccessControlAllowMethods, setAccessControlAllowOrigin, setAccessControlExposeHeaders, setAccessControlMaxAge, setAccessControlMaxAge, setAccessControlRequestHeaders, setAccessControlRequestMethod, setAllow, setBasicAuth, setBasicAuth, setBasicAuth, setBearerAuth, setCacheControl, setCacheControl, setConnection, setConnection, setContentDisposition, setContentDispositionFormData, setContentLanguage, setContentLength, setContentType, setDate, setDate, setDate, setDate, setETag, setExpires, setExpires, setExpires, setHost, setIfMatch, setIfMatch, setIfModifiedSince, setIfModifiedSince, setIfModifiedSince, setIfNoneMatch, setIfNoneMatch, setIfUnmodifiedSince, setIfUnmodifiedSince, setIfUnmodifiedSince, setInstant, setLastModified, setLastModified, setLastModified, setLocation, setOrigin, setPragma, setRange, setUpgrade, setVary, setZonedDateTime, toCommaDelimitedString, writableHttpHeadersMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Mapcompute, computeIfAbsent, computeIfPresent, getOrDefault, merge, remove, replace, replace, replaceAllMethods inherited from interface org.springframework.util.MultiValueMapaddIfAbsent
- 
Field Details- 
SEC_WEBSOCKET_ACCEPT- See Also:
 
- 
SEC_WEBSOCKET_EXTENSIONS- See Also:
 
- 
SEC_WEBSOCKET_KEY- See Also:
 
- 
SEC_WEBSOCKET_PROTOCOL- See Also:
 
- 
SEC_WEBSOCKET_VERSION- See Also:
 
 
- 
- 
Constructor Details- 
WebSocketHttpHeaderspublic WebSocketHttpHeaders()Create a new instance.
- 
WebSocketHttpHeadersCreate an instance that wraps the given pre-existing HttpHeaders and also propagate all changes to it.- Parameters:
- headers- the HTTP headers to wrap
 
 
- 
- 
Method Details- 
setSecWebSocketAcceptSets the (new) value of theSec-WebSocket-Acceptheader.- Parameters:
- secWebSocketAccept- the value of the header
 
- 
getSecWebSocketAcceptReturns the value of theSec-WebSocket-Acceptheader.- Returns:
- the value of the header
 
- 
getSecWebSocketExtensionsReturns the value of theSec-WebSocket-Extensionsheader.- Returns:
- the value of the header
 
- 
setSecWebSocketExtensionsSets the (new) value(s) of theSec-WebSocket-Extensionsheader.- Parameters:
- extensions- the values for the header
 
- 
setSecWebSocketKeySets the (new) value of theSec-WebSocket-Keyheader.- Parameters:
- secWebSocketKey- the value of the header
 
- 
getSecWebSocketKeyReturns the value of theSec-WebSocket-Keyheader.- Returns:
- the value of the header
 
- 
setSecWebSocketProtocolSets the (new) value of theSec-WebSocket-Protocolheader.- Parameters:
- secWebSocketProtocol- the value of the header
 
- 
setSecWebSocketProtocolSets the (new) value of theSec-WebSocket-Protocolheader.- Parameters:
- secWebSocketProtocols- the value of the header
 
- 
getSecWebSocketProtocolReturns the value of theSec-WebSocket-Keyheader.- Returns:
- the value of the header
 
- 
setSecWebSocketVersionSets the (new) value of theSec-WebSocket-Versionheader.- Parameters:
- secWebSocketVersion- the value of the header
 
- 
getSecWebSocketVersionReturns the value of theSec-WebSocket-Versionheader.- Returns:
- the value of the header
 
- 
getFirstReturn the first header value for the given header name, if any.- Specified by:
- getFirstin interface- MultiValueMap<String,- String> 
- Overrides:
- getFirstin class- HttpHeaders
- Parameters:
- headerName- the header name
- Returns:
- the first header value; or null
 
- 
addAdd the given, single header value under the given name.- Specified by:
- addin interface- MultiValueMap<String,- String> 
- Overrides:
- addin class- HttpHeaders
- Parameters:
- headerName- the header name
- headerValue- the header value
- Throws:
- UnsupportedOperationException- if adding headers is not supported
- See Also:
 
- 
setSet the given, single header value under the given name.- Specified by:
- setin interface- MultiValueMap<String,- String> 
- Overrides:
- setin class- HttpHeaders
- Parameters:
- headerName- the header name
- headerValue- the header value
- Throws:
- UnsupportedOperationException- if adding headers is not supported
- See Also:
 
- 
setAllDescription copied from interface:MultiValueMapSet the given values under.- Specified by:
- setAllin interface- MultiValueMap<String,- String> 
- Overrides:
- setAllin class- HttpHeaders
- Parameters:
- values- the values.
 
- 
toSingleValueMapDescription copied from interface:MultiValueMapReturn aMapwith the first values contained in thisMultiValueMap. The difference between this method andMultiValueMap.asSingleValueMap()is that this method returns a copy of the entries of this map, whereas the latter returns a view.- Specified by:
- toSingleValueMapin interface- MultiValueMap<String,- String> 
- Overrides:
- toSingleValueMapin class- HttpHeaders
- Returns:
- a single value representation of this map
 
- 
sizepublic int size()
- 
isEmptypublic boolean isEmpty()
- 
containsKey- Specified by:
- containsKeyin interface- Map<String,- List<String>> 
- Overrides:
- containsKeyin class- HttpHeaders
 
- 
containsValue- Specified by:
- containsValuein interface- Map<String,- List<String>> 
- Overrides:
- containsValuein class- HttpHeaders
 
- 
get
- 
put
- 
remove
- 
putAll
- 
clearpublic void clear()
- 
keySet
- 
values
- 
entrySet
- 
forEach
- 
putIfAbsent- Specified by:
- putIfAbsentin interface- Map<String,- List<String>> 
- Overrides:
- putIfAbsentin class- HttpHeaders
 
- 
equals
- 
hashCodepublic int hashCode()
- 
toString- Overrides:
- toStringin class- HttpHeaders
 
 
-