@@ -0,0 +1,2982 @@
+/*%0A * Copyright (C) 2016-2019 Dennis Neufeld%0A *%0A * This program is free software: you can redistribute it and/or modify%0A * it under the terms of the GNU Affero General Public License as published%0A * by the Free Software Foundation, either version 3 of the License, or%0A * (at your option) any later version.%0A *%0A * This program is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A * GNU Affero General Public License for more details.%0A *%0A * You should have received a copy of the GNU Affero General Public License%0A * along with this program.  If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A */%0A%0Apackage space.npstr.wolfia.config;%0A%0Aimport io.undertow.connector.ByteBufferPool;%0Aimport io.undertow.server.DefaultByteBufferPool;%0Aimport io.undertow.websockets.jsr.WebSocketDeploymentInfo;%0Aimport org.springframework.beans.factory.DisposableBean;%0Aimport org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory;%0Aimport org.springframework.boot.web.server.WebServerFactoryCustomizer;%0Aimport org.springframework.context.annotation.Bean;%0Aimport org.springframework.context.annotation.Configuration;%0Aimport org.springframework.core.Ordered;%0A%0A/**%0A * This just exists to get rid off a nasty Undertow warning%0A * %3Cp%3E%0A * io.undertow.websockets.jsr: %22UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used%22%0A */%0A@Configuration%0Apublic class WebsocketConfig %7B%0A%0A    @Bean%0A    public WebServerFactoryCustomizer undertowWebSocketServletWebServerCustomizer() %7B%0A        return new UndertowWebSocketServletWebServerCustomizer();%0A    %7D%0A%0A    private static class UndertowWebSocketServletWebServerCustomizer%0A            implements WebServerFactoryCustomizer%3CUndertowServletWebServerFactory%3E, Ordered, DisposableBean %7B%0A%0A        // Optimal size for direct buffers is 16kB according to Undertow docs%0A        // http://undertow.io/undertow-docs/undertow-docs-2.0.0/index.html#the-undertow-buffer-pool%0A        private final ByteBufferPool buffers = new DefaultByteBufferPool(true, 16 * 1024, 100, 12);%0A%0A        @Override%0A        public void customize(UndertowServletWebServerFactory factory) %7B%0A            factory.addDeploymentInfoCustomizers(deploymentInfo -%3E %7B%0A                WebSocketDeploymentInfo info = (WebSocketDeploymentInfo) deploymentInfo.getServletContextAttributes().get(WebSocketDeploymentInfo.ATTRIBUTE_NAME);%0A                if (info == null) %7B%0A                    info = new WebSocketDeploymentInfo();%0A                    deploymentInfo.addServletContextAttribute(WebSocketDeploymentInfo.ATTRIBUTE_NAME, info);%0A                %7D%0A%0A                info.setBuffers(this.buffers);%0A            %7D);%0A        %7D%0A%0A        @Override%0A        public int getOrder() %7B%0A            return Ordered.LOWEST_PRECEDENCE;%0A        %7D%0A%0A        @Override%0A        public void destroy() %7B%0A            this.buffers.close();%0A        %7D%0A    %7D%0A%7D%0A

Fix undertow warning about missing config