From e0c7aa5ecc1f98c2ed49d323b0390e20c5a2086c Mon Sep 17 00:00:00 2001 From: "Jonguk. Lim" Date: Mon, 28 Oct 2024 11:08:59 +0900 Subject: [PATCH] =?UTF-8?q?conf:=20=ED=86=B0=EC=BC=93=20AJP=20=EB=AA=A8?= =?UTF-8?q?=EB=93=88=20=ED=99=9C=EC=84=B1=ED=99=94=20-=20local-can,=20prod?= =?UTF-8?q?-can(=EC=B2=9C=EC=95=88)=20=EC=9D=B8=20=EA=B2=BD=EC=9A=B0?= =?UTF-8?q?=EB=A7=8C=20port=2018009?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/support/TomcatConfiguration.java | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 mens-core/src/main/java/kr/xit/core/spring/config/support/TomcatConfiguration.java diff --git a/mens-core/src/main/java/kr/xit/core/spring/config/support/TomcatConfiguration.java b/mens-core/src/main/java/kr/xit/core/spring/config/support/TomcatConfiguration.java new file mode 100644 index 0000000..f0bb106 --- /dev/null +++ b/mens-core/src/main/java/kr/xit/core/spring/config/support/TomcatConfiguration.java @@ -0,0 +1,37 @@ +package kr.xit.core.spring.config.support; + +import java.net.*; + +import org.apache.catalina.connector.*; +import org.apache.coyote.ajp.*; +import org.springframework.boot.web.embedded.tomcat.*; +import org.springframework.boot.web.servlet.server.*; +import org.springframework.context.annotation.*; + +@Configuration +@Profile({"local-can", "prod-can"}) +public class TomcatConfiguration { + + @Bean + public ServletWebServerFactory servletContainer() { + TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory(); + tomcat.addAdditionalTomcatConnectors(createAjpConnector()); + return tomcat; + } + + private Connector createAjpConnector() { + Connector ajpConnector = new Connector("AJP/1.3"); + ajpConnector.setPort(18009); + ajpConnector.setSecure(false); + ajpConnector.setAllowTrace(false); + ajpConnector.setScheme("http"); + ((AbstractAjpProtocol) ajpConnector.getProtocolHandler()).setSecretRequired(false); + try { + AjpNioProtocol protocol = (AjpNioProtocol) ajpConnector.getProtocolHandler(); + protocol.setAddress(InetAddress.getByName("0.0.0.0")); + } catch (UnknownHostException e) { + throw new RuntimeException(e); + } + return ajpConnector; + } +}