public class WebSocketExtension extends Object
Modifier and Type | Field and Description |
---|---|
static String |
PERMESSAGE_DEFLATE
The name of
permessage-deflate extension that is
defined in 7. The "permessage-deflate" Extension in RFC 7692. |
Constructor and Description |
---|
WebSocketExtension(String name)
Constructor with an extension name.
|
WebSocketExtension(WebSocketExtension source)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsParameter(String key)
Check if the parameter identified by the key is contained.
|
String |
getName()
Get the extension name.
|
String |
getParameter(String key)
Get the value of the specified parameter.
|
Map<String,String> |
getParameters()
Get the parameters.
|
static WebSocketExtension |
parse(String string)
Parse a string as a
WebSocketExtension . |
WebSocketExtension |
setParameter(String key,
String value)
Set a value to the specified parameter.
|
String |
toString()
Stringify this object into the format "{name}[; {key}[={value}]]*".
|
public static final String PERMESSAGE_DEFLATE
permessage-deflate
extension that is
defined in 7. The "permessage-deflate" Extension in RFC 7692.public WebSocketExtension(String name)
name
- The extension name.IllegalArgumentException
- The given name is not a valid token.public WebSocketExtension(WebSocketExtension source)
source
- A source extension. Must not be null
.IllegalArgumentException
- The given argument is null
.public String getName()
public Map<String,String> getParameters()
public boolean containsParameter(String key)
key
- The name of the parameter.true
if the parameter is contained.public String getParameter(String key)
key
- The name of the parameter.null
may be returned.public WebSocketExtension setParameter(String key, String value)
key
- The name of the parameter.value
- The value of the parameter. If not null
, it must be
a valid token. Note that RFC 6455 says "When using the quoted-string syntax
variant, the value after quoted-string unescaping MUST
conform to the 'token' ABNF."this
object.IllegalArgumentException
- null
and it is not a valid token.
public String toString()
public static WebSocketExtension parse(String string)
WebSocketExtension
. The input string
should comply with the format described in 9.1. Negotiating
Extensions in RFC 6455.string
- A string that represents a WebSocket extension.WebSocketExtension
instance that represents
the given string. If the input string does not comply with
RFC 6455, null
is returned.Copyright © 2021. All rights reserved.