Package org.springframework.web.socket
Class WebSocketExtension
java.lang.Object
org.springframework.web.socket.WebSocketExtension
- Direct Known Subclasses:
StandardToWebSocketExtensionAdapter
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, for example, extensions "foo, bar" will be executed as "bar(foo(message))".
- Since:
- 4.0
- Author:
- Brian Clozel, Juergen Hoeller
- See Also:
-
Constructor Summary
ConstructorDescriptionWebSocketExtension
(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. -
Method Summary
Modifier and TypeMethodDescriptionboolean
getName()
Return the name of the extension (nevernull
or empty).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.toString()
-
Constructor Details
-
WebSocketExtension
Create a WebSocketExtension with the given name.- Parameters:
name
- the name of the extension
-
WebSocketExtension
Create a WebSocketExtension with the given name and parameters.- Parameters:
name
- the name of the extensionparameters
- the parameters
-
-
Method Details
-
getName
Return the name of the extension (nevernull
or empty). -
getParameters
Return the parameters of the extension (nevernull
). -
equals
-
hashCode
public int hashCode() -
toString
-
parseExtensions
Parse the given, comma-separated string into a list ofWebSocketExtension
objects.This method can be used to parse a "Sec-WebSocket-Extension" header.
- Parameters:
extensions
- the string to parse- Returns:
- the list of extensions
- Throws:
IllegalArgumentException
- if the string cannot be parsed
-