All Downloads are FREE. Search and download functionalities are using the official Maven repository.

me.youm.frame.webmvc.server.UndertowServerFactoryCustomizer Maven / Gradle / Ivy

There is a newer version: 1.2.5
Show newest version
package me.youm.frame.webmvc.server;

import io.undertow.server.DefaultByteBufferPool;
import io.undertow.websockets.jsr.WebSocketDeploymentInfo;
import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;

/**
 * 解决undertow警告Buffer pool was not set on WebSocketDeploymentInfo
 *
 * @author youta
 */
public class UndertowServerFactoryCustomizer implements WebServerFactoryCustomizer {

    @Override
    public void customize(UndertowServletWebServerFactory factory) {
        factory.addDeploymentInfoCustomizers(deploymentInfo -> {
            WebSocketDeploymentInfo webSocketDeploymentInfo = new WebSocketDeploymentInfo();
            webSocketDeploymentInfo.setBuffers(new DefaultByteBufferPool(false, 1024));
            deploymentInfo.addServletContextAttribute("io.undertow.websockets.jsr.WebSocketDeploymentInfo", webSocketDeploymentInfo);
        });
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy