io.undertow.websockets.extensions

## Class PerMessageDeflateHandshake

- java.lang.Object
- - io.undertow.websockets.extensions.PerMessageDeflateHandshake

All Implemented Interfaces:
  ExtensionHandshake

    public class PerMessageDeflateHandshake
    extends Object
    implements ExtensionHandshake

Implementation of `permessage-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
`static int` `DEFAULT_DEFLATER` Default configuration for DEFLATE algorithm implementation

### Constructor Summary

Constructors
Constructor and Description
`PerMessageDeflateHandshake()`
`PerMessageDeflateHandshake(boolean client)` Create a new `PerMessageDeflateHandshake` instance.
`PerMessageDeflateHandshake(boolean client, boolean compressContextTakeover, boolean decompressContextTakeover)` Create a new `PerMessageDeflateHandshake` instance.
`PerMessageDeflateHandshake(boolean client, int deflaterLevel)` Create a new `PerMessageDeflateHandshake` instance.
`PerMessageDeflateHandshake(boolean client, int deflaterLevel, boolean compressContextTakeover, boolean decompressContextTakeover)` Create a new `PerMessageDeflateHandshake` instance.

### Method Summary

All Methods Instance Methods Concrete Methods
`WebSocketExtension` `accept(WebSocketExtension extension)` Validate if an extension request is accepted.
`ExtensionFunction` `create()` Create a new instance of the `ExtensionFunction` 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.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### 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 new `PerMessageDeflateHandshake` 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 new `PerMessageDeflateHandshake` instance.

Parameters:
  `client` - indicate if extension is configured in client (`true` ) context or server (`false` ) context
  `deflaterLevel` - the level of configuration of DEFLATE algorithm implementation

#### PerMessageDeflateHandshake

    public PerMessageDeflateHandshake(boolean client,
                                      boolean compressContextTakeover,
                                      boolean decompressContextTakeover)

Create a new `PerMessageDeflateHandshake` instance.

Parameters:
  `client` - flag for client (`true` ) context or server (`false` ) context
  `compressContextTakeover` - flag for compressor context takeover or without compressor context
  `decompressContextTakeover` - flag for decompressor context takeover or without decompressor context

#### PerMessageDeflateHandshake

    public PerMessageDeflateHandshake(boolean client,
                                      int deflaterLevel,
                                      boolean compressContextTakeover,
                                      boolean decompressContextTakeover)

Create a new `PerMessageDeflateHandshake` instance.

Parameters:
  `client` - flag for client (`true` ) context or server (`false` ) context
  `deflaterLevel` - the level of configuration of DEFLATE algorithm implementation
  `compressContextTakeover` - flag for compressor context takeover or without compressor context
  `decompressContextTakeover` - flag for decompressor context takeover or without decompressor context

### Method Detail

#### getName

    public String getName()

Specified by:
  `getName` in interface `ExtensionHandshake`
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 interface `ExtensionHandshake`
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 interface `ExtensionHandshake`
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 the `ExtensionFunction` associated to this WebSocket Extension.

Specified by:
  `create` in interface `ExtensionHandshake`
Returns:
  a new instance `ExtensionFunction`