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

cn.herodotus.engine.web.server.autoconfigure.configuration.UndertowWebServerFactoryCustomizer Maven / Gradle / Ivy

There is a newer version: 3.3.4.0
Show newest version
/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright (c) 2020-2030 郑庚伟 ZHENGGENGWEI (码匠君),  Licensed under the AGPL License
 *
 * This file is part of Herodotus Engine.
 *
 * Herodotus Engine is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Herodotus Engine is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see .
 */

package cn.herodotus.engine.web.server.autoconfigure.configuration;

import io.undertow.server.DefaultByteBufferPool;
import io.undertow.websockets.jsr.WebSocketDeploymentInfo;
import jakarta.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.web.embedded.undertow.UndertowServletWebServerFactory;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.context.annotation.Configuration;

/**
 * 

Description: Undertow 配置解决 启动的一个WARN问题

* * @author : gengwei.zheng * @date : 2019/11/17 16:07 */ @Configuration(proxyBeanMethods = false) public class UndertowWebServerFactoryCustomizer implements WebServerFactoryCustomizer { private static final Logger log = LoggerFactory.getLogger(UndertowWebServerFactoryCustomizer.class); @PostConstruct public void postConstruct() { log.debug("[Herodotus] |- SDK [Undertow WebServer Factory Customizer] Auto Configure."); } @Override public void customize(UndertowServletWebServerFactory factory) { factory.addDeploymentInfoCustomizers(deploymentInfo -> { WebSocketDeploymentInfo webSocketDeploymentInfo = new WebSocketDeploymentInfo(); webSocketDeploymentInfo.setBuffers(new DefaultByteBufferPool(false, 1024)); deploymentInfo.addServletContextAttribute(WebSocketDeploymentInfo.ATTRIBUTE_NAME, webSocketDeploymentInfo); }); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy