Based on your suggestion, we are able to add extension PerMessageDeflateHandshake to WebSocketDeploymentInfo.

In the constructor of the ServerWebSocketContainer, the installedExtensions has one element of PerMessageDeflateHandshake. But when the getInstalledExtensions is called, it still returns empty set, should that function return installedExtensions instead of Collections.emptySet()?

    public ServerWebSocketContainer(final ClassIntrospecter classIntrospecter, final ClassLoader classLoader, XnioWorker xnioWorker, ByteBufferPool bufferPool, ThreadSetupAction threadSetupAction, boolean dispatchToWorker, InetSocketAddress clientBindAddress, WebSocketReconnectHandler reconnectHandler, List<Extension> installedExtensions) {
        this.classIntrospecter = classIntrospecter;
        this.bufferPool = bufferPool;
        this.xnioWorker = xnioWorker;
        this.threadSetupAction = threadSetupAction;
        this.dispatchToWorker = dispatchToWorker;
        this.clientBindAddress = clientBindAddress;
        this.installedExtensions = new ArrayList<>(installedExtensions);
        List<WebsocketClientSslProvider> clientSslProviders = new ArrayList<>();
        for (WebsocketClientSslProvider provider : ServiceLoader.load(WebsocketClientSslProvider.class, classLoader)) {
            clientSslProviders.add(provider);
        }

        this.clientSslProviders = Collections.unmodifiableList(clientSslProviders);
        this.webSocketReconnectHandler = reconnectHandler;
    }

    public Set<Extension> getInstalledExtensions() {
        return Collections.emptySet();
    }



From: Stuart Douglas <sdouglas@redhat.com>
Sent: Wednesday, June 29, 2016 7:00:31 PM
To: PingShan Li
Cc: undertow-dev@lists.jboss.org
Subject: Re: [undertow-dev] permessage-deflate extension is not supported, getInstalledExtensions() returns empty set in ServerWebSocketContainer.java
 
You need to invoke
io.undertow.websockets.jsr.WebSocketDeploymentInfo#addExtension with
an instance of io.undertow.websockets.extensions.PerMessageDeflateHandshake


Stuart

On Thu, Jun 30, 2016 at 6:16 AM, PingShan Li <ping.li@firemon.com> wrote:
> --- Problem:
> client's request for compression is ignored.
>
> The client sends the request for compression:
>
> Sec-WebSocket-Extensions: permessage-deflate; client_no_context_takeover;
> client_max_window_bits\r\n
>
>
> Webserver receives the client request,
>
>
> org.springframework.web.socket.server.support.AbstractHandshakeHandler.java:
>
> doHandshake function: try to see if requested extension is supported
>
> String subProtocol = selectProtocol(headers.getSecWebSocketProtocol(),
> wsHandler);
> List<WebSocketExtension> requested = headers.getSecWebSocketExtensions();
> List<WebSocketExtension> supported =
> this.requestUpgradeStrategy.getSupportedExtensions(request);
> List<WebSocketExtension> extensions = filterRequestedExtensions(request,
> requested, supported);
>
> getSupportedExtensions calls into the following function, which always
> returns empty set for installed extensions.
>
> io.undertow.websockets.jsr.ServerWebSocketContainer.java:
>
>     public Set<Extension> getInstalledExtensions() {
>         return Collections.emptySet();
>     }
>
> My question is:
> how to tell spring framework that the permessage-deflate extension is
> supported by undertow?
>
> Environement:
> Undertow 1.3.22 Final is used by springframework:
> +-
> org.springframework.boot:spring-boot-starter-undertow:jar:1.3.5.RELEASE:compile
> [INFO] |  |  +- io.undertow:undertow-core:jar:1.3.22.Final:compile
> [INFO] |  |  +- io.undertow:undertow-servlet:jar:1.3.22.Final:compile
> [INFO] |  |  +- io.undertow:undertow-websockets-jsr:jar:1.3.22.Final:compile
>
>
> Thanks
>
>
>
>
>
>
> _______________________________________________
> undertow-dev mailing list
> undertow-dev@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/undertow-dev