41 lines
1.4 KiB
Java
41 lines
1.4 KiB
Java
package com.dbnt.faisp.config;
|
|
|
|
import org.apache.catalina.connector.Connector;
|
|
import org.apache.coyote.ProtocolHandler;
|
|
import org.apache.coyote.ajp.AbstractAjpProtocol;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
|
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import java.net.InetAddress;
|
|
|
|
@Configuration
|
|
public class TomcatConfiguration {
|
|
|
|
@Value("${tomcat.ajp.protocol}")
|
|
private String protocol;
|
|
|
|
@Bean
|
|
public ServletWebServerFactory servletContainer() {
|
|
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
|
|
tomcat.addAdditionalTomcatConnectors(createAjpConnector());
|
|
return tomcat;
|
|
}
|
|
|
|
private Connector createAjpConnector() {
|
|
Connector ajpConnector = new Connector(protocol);
|
|
ajpConnector.setPort(8009);
|
|
ajpConnector.setSecure(false);
|
|
ajpConnector.setAllowTrace(false);
|
|
ajpConnector.setScheme("http");
|
|
ajpConnector.setProperty("address", "0.0.0.0");
|
|
ajpConnector.setProperty("allowedRequestAttributesPattern", ".*");
|
|
if(protocol.contains("AJP")){
|
|
((AbstractAjpProtocol)ajpConnector.getProtocolHandler()).setSecretRequired(false);
|
|
}
|
|
return ajpConnector;
|
|
}
|
|
|
|
} |