Class PerMessageDeflateHandshake
- java.lang.Object
-
- io.undertow.websockets.extensions.PerMessageDeflateHandshake
-
- All Implemented Interfaces:
ExtensionHandshake
public class PerMessageDeflateHandshake extends Object implements ExtensionHandshake
Implementation ofpermessage-deflate
WebSocket Extension handshake.This implementation supports parameters:
server_no_context_takeover, client_no_context_takeover
.This implementation does not support parameters:
server_max_window_bits, client_max_window_bits
.- Author:
- Lucas Ponce
- See Also:
- Compression Extensions for WebSocket
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_DEFLATER
Default configuration for DEFLATE algorithm implementation
-
Constructor Summary
Constructors Constructor Description PerMessageDeflateHandshake()
PerMessageDeflateHandshake(boolean client)
Create a newPerMessageDeflateHandshake
instance.PerMessageDeflateHandshake(boolean client, boolean compressContextTakeover, boolean decompressContextTakeover)
Create a newPerMessageDeflateHandshake
instance.PerMessageDeflateHandshake(boolean client, int deflaterLevel)
Create a newPerMessageDeflateHandshake
instance.PerMessageDeflateHandshake(boolean client, int deflaterLevel, boolean compressContextTakeover, boolean decompressContextTakeover)
Create a newPerMessageDeflateHandshake
instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WebSocketExtension
accept(WebSocketExtension extension)
Validate if an extension request is accepted.ExtensionFunction
create()
Create a new instance of theExtensionFunction
associated to this WebSocket Extension.String
getName()
boolean
isIncompatible(List<ExtensionHandshake> extensions)
Validate if current extension is compatible with previously negotiated in the server side.
-
-
-
Field Detail
-
DEFAULT_DEFLATER
public static final int DEFAULT_DEFLATER
Default configuration for DEFLATE algorithm implementation- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PerMessageDeflateHandshake
public PerMessageDeflateHandshake()
-
PerMessageDeflateHandshake
public PerMessageDeflateHandshake(boolean client)
Create a newPerMessageDeflateHandshake
instance.- Parameters:
client
- indicate if extension is configured in client (true
) context or server (false
) context.
-
PerMessageDeflateHandshake
public PerMessageDeflateHandshake(boolean client, int deflaterLevel)
Create a newPerMessageDeflateHandshake
instance.- Parameters:
client
- indicate if extension is configured in client (true
) context or server (false
) contextdeflaterLevel
- the level of configuration of DEFLATE algorithm implementation
-
PerMessageDeflateHandshake
public PerMessageDeflateHandshake(boolean client, boolean compressContextTakeover, boolean decompressContextTakeover)
Create a newPerMessageDeflateHandshake
instance.- Parameters:
client
- flag for client (true
) context or server (false
) contextcompressContextTakeover
- flag for compressor context takeover or without compressor contextdecompressContextTakeover
- flag for decompressor context takeover or without decompressor context
-
PerMessageDeflateHandshake
public PerMessageDeflateHandshake(boolean client, int deflaterLevel, boolean compressContextTakeover, boolean decompressContextTakeover)
Create a newPerMessageDeflateHandshake
instance.- Parameters:
client
- flag for client (true
) context or server (false
) contextdeflaterLevel
- the level of configuration of DEFLATE algorithm implementationcompressContextTakeover
- flag for compressor context takeover or without compressor contextdecompressContextTakeover
- flag for decompressor context takeover or without decompressor context
-
-
Method Detail
-
getName
public String getName()
- Specified by:
getName
in interfaceExtensionHandshake
- Returns:
- name of the WebSocket Extension
-
accept
public WebSocketExtension accept(WebSocketExtension extension)
Description copied from interface:ExtensionHandshake
Validate if an extension request is accepted.- Specified by:
accept
in interfaceExtensionHandshake
- Parameters:
extension
- the extension request representation- Returns:
- a new
WebSocketExtension
instance with parameters accepted;null
in case extension request is not accepted
-
isIncompatible
public boolean isIncompatible(List<ExtensionHandshake> extensions)
Description copied from interface:ExtensionHandshake
Validate if current extension is compatible with previously negotiated in the server side.- Specified by:
isIncompatible
in interfaceExtensionHandshake
- Parameters:
extensions
- a list of negotiated extensions- Returns:
true
if current extension is compatible;false
if current extension is not compatible
-
create
public ExtensionFunction create()
Description copied from interface:ExtensionHandshake
Create a new instance of theExtensionFunction
associated to this WebSocket Extension.- Specified by:
create
in interfaceExtensionHandshake
- Returns:
- a new instance
ExtensionFunction
-
-