类 WebSocketExtension
- java.lang.Object
- org.springframework.web.socket.WebSocketExtension
public class WebSocketExtension extends Object
Represents a WebSocket extension as defined in the RFC 6455. WebSocket extensions add protocol features to the WebSocket protocol. The extensions used within a session are negotiated during the handshake phase as follows:- the client may ask for specific extensions in the HTTP handshake request
- the server responds with the final list of extensions to use in the current session
WebSocket Extension HTTP headers may include parameters and follow RFC 7230 section 3.2
Note that the order of extensions in HTTP headers defines their order of execution, e.g. extensions "foo, bar" will be executed as "bar(foo(message))".
- 从以下版本开始:
- 4.0
- 作者:
- Brian Clozel, Juergen Hoeller
- 另请参阅:
- WebSocket Protocol Extensions, RFC 6455 - Section 9
构造器概要
构造器 构造器 说明 WebSocketExtension(String name)
Create a WebSocketExtension with the given name.WebSocketExtension(String name, Map<String,String> parameters)
Create a WebSocketExtension with the given name and parameters.
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 boolean
equals(Object other)
String
getName()
Return the name of the extension (nevernull) or empty
.Map<String,String>
getParameters()
Return the parameters of the extension (nevernull
).int
hashCode()
static List<WebSocketExtension>
parseExtensions(String extensions)
Parse the given, comma-separated string into a list ofWebSocketExtension
objects.String
toString()
构造器详细资料
WebSocketExtension
public WebSocketExtension(String name)
Create a WebSocketExtension with the given name.- 参数:
name
- the name of the extension
WebSocketExtension
public WebSocketExtension(String name, Map<String,String> parameters)
Create a WebSocketExtension with the given name and parameters.- 参数:
name
- the name of the extensionparameters
- the parameters
方法详细资料
getParameters
public Map<String,String> getParameters()
Return the parameters of the extension (nevernull
).
parseExtensions
public static List<WebSocketExtension> parseExtensions(String extensions)
Parse the given, comma-separated string into a list ofWebSocketExtension
objects.This method can be used to parse a "Sec-WebSocket-Extension" header.
- 参数:
extensions
- the string to parse- 返回:
- the list of extensions
- 抛出:
IllegalArgumentException
- if the string cannot be parsed