TomcatConfig.java 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package io.renren.config;
  2. import org.apache.catalina.Context;
  3. import org.apache.catalina.connector.Connector;
  4. import org.apache.tomcat.util.descriptor.web.SecurityCollection;
  5. import org.apache.tomcat.util.descriptor.web.SecurityConstraint;
  6. import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
  7. import org.springframework.context.annotation.Bean;
  8. import org.springframework.context.annotation.Configuration;
  9. @Configuration
  10. public class TomcatConfig {
  11. // @Bean
  12. // TomcatServletWebServerFactory tomcatServletWebServerFactory() {
  13. // TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(){
  14. // @Override
  15. // protected void postProcessContext(Context context) {
  16. // SecurityConstraint constraint = new SecurityConstraint();
  17. // constraint.setUserConstraint("CONFIDENTIAL");
  18. // SecurityCollection collection = new SecurityCollection();
  19. // collection.addPattern("/*");
  20. // constraint.addCollection(collection);
  21. // context.addConstraint(constraint);
  22. // }
  23. // };
  24. // factory.addAdditionalTomcatConnectors(createTomcatConnector());
  25. // return factory;
  26. // }
  27. // private Connector createTomcatConnector() {
  28. // Connector connector = new
  29. // Connector("org.apache.coyote.http11.Http11NioProtocol");
  30. // connector.setScheme("http");
  31. // connector.setPort(8080);
  32. // connector.setSecure(false);
  33. // connector.setRedirectPort(443);
  34. // return connector;
  35. // }
  36. }