Closed sushmitha007 closed 5 years ago
//package com.stackroute.searchupstreamservice.config; // //import org.apache.catalina.Context; //import org.apache.catalina.connector.Connector; //import org.apache.tomcat.util.descriptor.web.SecurityCollection; //import org.apache.tomcat.util.descriptor.web.SecurityConstraint; //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; // //@Configuration //public class ConnectorConfig{ // @Bean // public ServletWebServerFactory servletContainer() { // TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory() { // @Override // protected void postProcessContext(Context context) { // SecurityConstraint securityConstraint = new SecurityConstraint(); // securityConstraint.setUserConstraint("CONFIDENTIAL"); // SecurityCollection collection = new SecurityCollection(); // collection.addPattern("/*"); // securityConstraint.addCollection(collection); // context.addConstraint(securityConstraint); // } // }; // tomcat.addAdditionalTomcatConnectors(redirectConnector()); // return tomcat; // } // // @Value("${server.ports.http}") //Defined in application.properties file // int httpPort; // // @Value("${server.port}") //Defined in application.properties file // int httpsPort; // // private Connector redirectConnector() { // Connector connector = new Connector(TomcatServletWebServerFactory.DEFAULT_PROTOCOL); // connector.setScheme("http"); // connector.setPort(httpPort); // connector.setSecure(false); // connector.setRedirectPort(httpsPort); // return connector; // } //}
boeing-wave4-knowledgehub/search-upstream-service/src/main/java/com/stackroute/searchupstreamservice/config/ConnectorConfig.java
//package com.stackroute.searchupstreamservice.config; // //import org.apache.catalina.Context; //import org.apache.catalina.connector.Connector; //import org.apache.tomcat.util.descriptor.web.SecurityCollection; //import org.apache.tomcat.util.descriptor.web.SecurityConstraint; //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; // //@Configuration //public class ConnectorConfig{ // @Bean // public ServletWebServerFactory servletContainer() { // TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory() { // @Override // protected void postProcessContext(Context context) { // SecurityConstraint securityConstraint = new SecurityConstraint(); // securityConstraint.setUserConstraint("CONFIDENTIAL"); // SecurityCollection collection = new SecurityCollection(); // collection.addPattern("/*"); // securityConstraint.addCollection(collection); // context.addConstraint(securityConstraint); // } // }; // tomcat.addAdditionalTomcatConnectors(redirectConnector()); // return tomcat; // } // // @Value("${server.ports.http}") //Defined in application.properties file // int httpPort; // // @Value("${server.port}") //Defined in application.properties file // int httpsPort; // // private Connector redirectConnector() { // Connector connector = new Connector(TomcatServletWebServerFactory.DEFAULT_PROTOCOL); // connector.setScheme("http"); // connector.setPort(httpPort); // connector.setSecure(false); // connector.setRedirectPort(httpsPort); // return connector; // } //}
boeing-wave4-knowledgehub/search-upstream-service/src/main/java/com/stackroute/searchupstreamservice/config/ConnectorConfig.java