类 WebSocketHttpHeaders
- java.lang.Object
- org.springframework.http.HttpHeaders
- org.springframework.web.socket.WebSocketHttpHeaders
- 所有已实现的接口:
Serializable
,Map<String,List<String>>
,MultiValueMap<String,String>
public class WebSocketHttpHeaders extends HttpHeaders
AnHttpHeaders
variant that adds support for the HTTP headers defined by the WebSocket specification RFC 6455.- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev
- 另请参阅:
- 序列化表格
字段概要
字段 修饰符和类型 字段 说明 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
从类继承的字段 org.springframework.http.HttpHeaders
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
构造器概要
构造器 构造器 说明 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.
方法概要
所有方法 静态方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 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 theSec-WebSocket-Accept
header.List<WebSocketExtension>
getSecWebSocketExtensions()
Returns the value of theSec-WebSocket-Extensions
header.String
getSecWebSocketKey()
Returns the value of theSec-WebSocket-Key
header.List<String>
getSecWebSocketProtocol()
Returns the value of theSec-WebSocket-Key
header.String
getSecWebSocketVersion()
Returns the value of theSec-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)
已过时。as of 5.1.16, in favor of callingWebSocketHttpHeaders(HttpHeaders)
with a read-only wrapper fromHttpHeaders.readOnlyHttpHeaders(HttpHeaders)
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 theSec-WebSocket-Accept
header.void
setSecWebSocketExtensions(List<WebSocketExtension> extensions)
Sets the (new) value(s) of theSec-WebSocket-Extensions
header.void
setSecWebSocketKey(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(String secWebSocketVersion)
Sets the (new) value of theSec-WebSocket-Version
header.int
size()
Map<String,String>
toSingleValueMap()
Return aMap
with the first values contained in thisMultiValueMap
.String
toString()
Collection<List<String>>
values()
从类继承的方法 org.springframework.http.HttpHeaders
addAll, addAll, clearContentHeaders, encodeBasicAuth, formatHeaders, 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, getOrEmpty, getOrigin, getPragma, getRange, getUpgrade, getValuesAsList, getVary, readOnlyHttpHeaders, setAccept, setAcceptCharset, setAcceptLanguage, setAcceptLanguageAsLocales, 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, writableHttpHeaders
从接口继承的方法 java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
从接口继承的方法 org.springframework.util.MultiValueMap
addIfAbsent
字段详细资料
SEC_WEBSOCKET_ACCEPT
public static final String SEC_WEBSOCKET_ACCEPT
- 另请参阅:
- 常量字段值
SEC_WEBSOCKET_EXTENSIONS
public static final String SEC_WEBSOCKET_EXTENSIONS
- 另请参阅:
- 常量字段值
SEC_WEBSOCKET_KEY
public static final String SEC_WEBSOCKET_KEY
- 另请参阅:
- 常量字段值
SEC_WEBSOCKET_PROTOCOL
public static final String SEC_WEBSOCKET_PROTOCOL
- 另请参阅:
- 常量字段值
SEC_WEBSOCKET_VERSION
public static final String SEC_WEBSOCKET_VERSION
- 另请参阅:
- 常量字段值
构造器详细资料
WebSocketHttpHeaders
public WebSocketHttpHeaders()
Create a new instance.
WebSocketHttpHeaders
public WebSocketHttpHeaders(HttpHeaders headers)
Create an instance that wraps the given pre-existing HttpHeaders and also propagate all changes to it.- 参数:
headers
- the HTTP headers to wrap
方法详细资料
readOnlyWebSocketHttpHeaders
@Deprecated public static WebSocketHttpHeaders readOnlyWebSocketHttpHeaders(WebSocketHttpHeaders headers)
已过时。as of 5.1.16, in favor of callingWebSocketHttpHeaders(HttpHeaders)
with a read-only wrapper fromHttpHeaders.readOnlyHttpHeaders(HttpHeaders)
ReturnsWebSocketHttpHeaders
object that can only be read, not written to.
setSecWebSocketAccept
public void setSecWebSocketAccept(@Nullable String secWebSocketAccept)
Sets the (new) value of theSec-WebSocket-Accept
header.- 参数:
secWebSocketAccept
- the value of the header
getSecWebSocketAccept
@Nullable public String getSecWebSocketAccept()
Returns the value of theSec-WebSocket-Accept
header.- 返回:
- the value of the header
getSecWebSocketExtensions
public List<WebSocketExtension> getSecWebSocketExtensions()
Returns the value of theSec-WebSocket-Extensions
header.- 返回:
- the value of the header
setSecWebSocketExtensions
public void setSecWebSocketExtensions(List<WebSocketExtension> extensions)
Sets the (new) value(s) of theSec-WebSocket-Extensions
header.- 参数:
extensions
- the values for the header
setSecWebSocketKey
public void setSecWebSocketKey(@Nullable String secWebSocketKey)
Sets the (new) value of theSec-WebSocket-Key
header.- 参数:
secWebSocketKey
- the value of the header
getSecWebSocketKey
@Nullable public String getSecWebSocketKey()
Returns the value of theSec-WebSocket-Key
header.- 返回:
- the value of the header
setSecWebSocketProtocol
public void setSecWebSocketProtocol(String secWebSocketProtocol)
Sets the (new) value of theSec-WebSocket-Protocol
header.- 参数:
secWebSocketProtocol
- the value of the header
setSecWebSocketProtocol
public void setSecWebSocketProtocol(List<String> secWebSocketProtocols)
Sets the (new) value of theSec-WebSocket-Protocol
header.- 参数:
secWebSocketProtocols
- the value of the header
getSecWebSocketProtocol
public List<String> getSecWebSocketProtocol()
Returns the value of theSec-WebSocket-Key
header.- 返回:
- the value of the header
setSecWebSocketVersion
public void setSecWebSocketVersion(@Nullable String secWebSocketVersion)
Sets the (new) value of theSec-WebSocket-Version
header.- 参数:
secWebSocketVersion
- the value of the header
getSecWebSocketVersion
@Nullable public String getSecWebSocketVersion()
Returns the value of theSec-WebSocket-Version
header.- 返回:
- the value of the header
getFirst
@Nullable public String getFirst(String headerName)
Return the first header value for the given header name, if any.- 指定者:
getFirst
在接口中MultiValueMap<String,String>
- 覆盖:
getFirst
在类中HttpHeaders
- 参数:
headerName
- the header name- 返回:
- the first header value; or
null
add
public void add(String headerName, @Nullable String headerValue)
Add the given, single header value under the given name.- 指定者:
add
在接口中MultiValueMap<String,String>
- 覆盖:
add
在类中HttpHeaders
- 参数:
headerName
- the header nameheaderValue
- the header value- 抛出:
UnsupportedOperationException
- if adding headers is not supported- 另请参阅:
put(String, List)
,set(String, String)
set
public void set(String headerName, @Nullable String headerValue)
Set the given, single header value under the given name.- 指定者:
set
在接口中MultiValueMap<String,String>
- 覆盖:
set
在类中HttpHeaders
- 参数:
headerName
- the header nameheaderValue
- the header value- 抛出:
UnsupportedOperationException
- if adding headers is not supported- 另请参阅:
put(String, List)
,add(String, String)
setAll
public void setAll(Map<String,String> values)
从接口复制的说明:MultiValueMap
Set the given values under.- 指定者:
setAll
在接口中MultiValueMap<String,String>
- 覆盖:
setAll
在类中HttpHeaders
- 参数:
values
- the values.
toSingleValueMap
public Map<String,String> toSingleValueMap()
从接口复制的说明:MultiValueMap
Return aMap
with the first values contained in thisMultiValueMap
.- 指定者:
toSingleValueMap
在接口中MultiValueMap<String,String>
- 覆盖:
toSingleValueMap
在类中HttpHeaders
- 返回:
- a single value representation of this map
containsKey
public boolean containsKey(Object key)
- 指定者:
containsKey
在接口中Map<String,List<String>>
- 覆盖:
containsKey
在类中HttpHeaders
containsValue
public boolean containsValue(Object value)
- 指定者:
containsValue
在接口中Map<String,List<String>>
- 覆盖:
containsValue
在类中HttpHeaders
values
public Collection<List<String>> values()
toString
public String toString()
- 覆盖:
toString
在类中HttpHeaders