Class WebSocketHttpHeaders
java.lang.Object
org.springframework.http.HttpHeaders
org.springframework.web.socket.WebSocketHttpHeaders
- All Implemented Interfaces:
Serializable
public class WebSocketHttpHeaders
extends org.springframework.http.HttpHeaders
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
Fields inherited from class org.springframework.http.HttpHeaders
ACCEPT, 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 Summary
ConstructorsConstructorDescriptionCreate a new instance.WebSocketHttpHeaders
(org.springframework.http.HttpHeaders headers) Create an instance that wraps the given pre-existing HttpHeaders and also propagate all changes to it. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add the given, single header value under the given name.void
clear()
boolean
containsHeader
(String key) boolean
void
forEach
(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-Accept
header.Returns the value of theSec-WebSocket-Extensions
header.Returns the value of theSec-WebSocket-Key
header.Returns the value of theSec-WebSocket-Protocol
header.Returns the value of theSec-WebSocket-Version
header.int
hashCode()
boolean
isEmpty()
void
void
putAll
(org.springframework.http.HttpHeaders headers) putIfAbsent
(String headerName, List<String> headerValues) void
Set the given, single header value under the given name.void
void
setSecWebSocketAccept
(@Nullable String secWebSocketAccept) Sets the (new) value of theSec-WebSocket-Accept
header.void
setSecWebSocketExtensions
(List<WebSocketExtension> extensions) Sets the (new) value(s) of theSec-WebSocket-Extensions
header.void
setSecWebSocketKey
(@Nullable String secWebSocketKey) Sets the (new) value of theSec-WebSocket-Key
header.void
setSecWebSocketProtocol
(String secWebSocketProtocol) Sets the (new) value of theSec-WebSocket-Protocol
header.void
setSecWebSocketProtocol
(List<String> secWebSocketProtocols) Sets the (new) value of theSec-WebSocket-Protocol
header.void
setSecWebSocketVersion
(@Nullable String secWebSocketVersion) Sets the (new) value of theSec-WebSocket-Version
header.int
size()
toString()
Methods inherited from class org.springframework.http.HttpHeaders
addAll, addAll, asMultiValueMap, asSingleValueMap, clearContentHeaders, containsHeaderValue, copyOf, copyOf, 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, getOrDefault, getOrEmpty, getOrigin, getPragma, getRange, getUpgrade, getValuesAsList, getVary, hasHeaderValues, 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
-
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
-
WebSocketHttpHeaders
public WebSocketHttpHeaders()Create a new instance. -
WebSocketHttpHeaders
public WebSocketHttpHeaders(org.springframework.http.HttpHeaders headers) Create 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
-
setSecWebSocketAccept
-
getSecWebSocketAccept
-
getSecWebSocketExtensions
Returns the value of theSec-WebSocket-Extensions
header.- Returns:
- the value of the header
-
setSecWebSocketExtensions
Sets the (new) value(s) of theSec-WebSocket-Extensions
header.- Parameters:
extensions
- the values for the header
-
setSecWebSocketKey
-
getSecWebSocketKey
-
setSecWebSocketProtocol
Sets the (new) value of theSec-WebSocket-Protocol
header.- Parameters:
secWebSocketProtocol
- the value of the header
-
setSecWebSocketProtocol
-
getSecWebSocketProtocol
-
setSecWebSocketVersion
-
getSecWebSocketVersion
-
getFirst
-
add
Add the given, single header value under the given name.- Overrides:
add
in classorg.springframework.http.HttpHeaders
- Parameters:
headerName
- the header nameheaderValue
- the header value- Throws:
UnsupportedOperationException
- if adding headers is not supported- See Also:
-
set
Set the given, single header value under the given name.- Overrides:
set
in classorg.springframework.http.HttpHeaders
- Parameters:
headerName
- the header nameheaderValue
- the header value- Throws:
UnsupportedOperationException
- if adding headers is not supported- See Also:
-
setAll
-
toSingleValueMap
-
size
public int size()- Overrides:
size
in classorg.springframework.http.HttpHeaders
-
isEmpty
public boolean isEmpty()- Overrides:
isEmpty
in classorg.springframework.http.HttpHeaders
-
containsHeader
- Overrides:
containsHeader
in classorg.springframework.http.HttpHeaders
-
get
-
put
-
remove
-
putAll
public void putAll(org.springframework.http.HttpHeaders headers) - Overrides:
putAll
in classorg.springframework.http.HttpHeaders
-
putAll
-
clear
public void clear()- Overrides:
clear
in classorg.springframework.http.HttpHeaders
-
headerNames
-
headerSet
-
forEach
- Overrides:
forEach
in classorg.springframework.http.HttpHeaders
-
putIfAbsent
-
equals
-
hashCode
public int hashCode()- Overrides:
hashCode
in classorg.springframework.http.HttpHeaders
-
toString
- Overrides:
toString
in classorg.springframework.http.HttpHeaders
-