Java 类org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer 实例源码

项目:xm-gate    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);

    /*
     * Enable HTTP/2 for Undertow - https://twitter.com/ankinson/status/829256167700492288
     * HTTP/2 requires HTTPS, so HTTP requests will fallback to HTTP/1.1.
     * See the JHipsterProperties class and your application-*.yml configuration files
     * for more information.
     */
    if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:xm-ms-entity    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);

    /*
     * Enable HTTP/2 for Undertow - https://twitter.com/ankinson/status/829256167700492288
     * HTTP/2 requires HTTPS, so HTTP requests will fallback to HTTP/1.1.
     * See the JHipsterProperties class and your application-*.yml configuration files
     * for more information.
     */
    if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:karate    文件:TomcatConfig.java   
@Bean
public EmbeddedServletContainerCustomizer cookieProcessorCustomizer() {
    return new EmbeddedServletContainerCustomizer() {
        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {
            if (container instanceof TomcatEmbeddedServletContainerFactory) {
                TomcatEmbeddedServletContainerFactory factory = (TomcatEmbeddedServletContainerFactory) container;
                factory.addContextCustomizers(new TomcatContextCustomizer() {
                    @Override
                    public void customize(Context context) {
                        context.setCookieProcessor(new LegacyCookieProcessor());
                    }                        
                });
            }
        }

    };
}
项目:xm-ms-config    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);

    /*
     * Enable HTTP/2 for Undertow - https://twitter.com/ankinson/status/829256167700492288
     * HTTP/2 requires HTTPS, so HTTP requests will fallback to HTTP/1.1.
     * See the JHipsterProperties class and your application-*.yml configuration files
     * for more information.
     */
    if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:seldon-core    文件:CustomizationBean.java   
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    logger.info("Customizing EmbeddedServlet");

    Integer serverPort;
    { // setup the server port using the env vars
        String engineServerPortString = System.getenv().get(ENGINE_SERVER_PORT_KEY);
        if (engineServerPortString == null) {
            logger.error("FAILED to find env var [{}], will use defaults for engine server port", ENGINE_SERVER_PORT_KEY);
            serverPort = defaultServerPort;
        } else {
            logger.info("FOUND env var [{}], will use for engine server port", ENGINE_SERVER_PORT_KEY);
            serverPort = Integer.parseInt(engineServerPortString);
        }
    }

    logger.info("setting serverPort[{}]", serverPort);
    container.setPort(serverPort);
}
项目:apollo-custom    文件:TomcatContainerCustomizer.java   
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
  if (!(container instanceof TomcatEmbeddedServletContainerFactory)) {
    return;
  }
  if (!environment.containsProperty(TOMCAT_ACCEPTOR_COUNT)) {
    return;
  }
  TomcatEmbeddedServletContainerFactory tomcat =
      (TomcatEmbeddedServletContainerFactory) container;
  tomcat.addConnectorCustomizers(new TomcatConnectorCustomizer() {
    @Override
    public void customize(Connector connector) {
      ProtocolHandler handler = connector.getProtocolHandler();
      if (handler instanceof Http11NioProtocol) {
        Http11NioProtocol http = (Http11NioProtocol) handler;
        int acceptCount = Integer.parseInt(environment.getProperty(TOMCAT_ACCEPTOR_COUNT));
        http.setBacklog(acceptCount);
        logger.info("Setting tomcat accept count to {}", acceptCount);
      }

    }
  });
}
项目:tinker-manager    文件:WebAppConfig.java   
@Bean
    public EmbeddedServletContainerCustomizer containerCustomizer() {
        return new EmbeddedServletContainerCustomizer() {
            @Override
            public void customize(ConfigurableEmbeddedServletContainer container) {
                ErrorPage page404 = new ErrorPage(HttpStatus.NOT_FOUND,"/404");
                container.addErrorPages(page404);
            }
        };
//        return (container -> {
//            ErrorPage error401Page = new ErrorPage(HttpStatus.UNAUTHORIZED, "/401.html");
//            ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/404.html");
//            ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500.html");
//
//            container.addErrorPages(error401Page, error404Page, error500Page);
//        });
    }
项目:various_demos    文件:Application.java   
@Bean
public EmbeddedServletContainerCustomizer embeddedServletContainerCustomizer() {
    return new EmbeddedServletContainerCustomizer() {
        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {
            if (container instanceof TomcatEmbeddedServletContainerFactory) {
                TomcatEmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory = (TomcatEmbeddedServletContainerFactory) container;


                RedisSessionHandlerValve valve = new RedisSessionHandlerValve();
                List<RedisSessionHandlerValve> valves = 
                        new ArrayList<RedisSessionHandlerValve>();
                valves.add(0, valve);
                tomcatEmbeddedServletContainerFactory.setContextValves(valves);
                tomcatEmbeddedServletContainerFactory.setPort(28080);    // Set the port of embeded tomcat as 28080 for default. 

                System.out.println("Enterring EmbeddedServletContainerCustomizer.customize()...");
                tomcatEmbeddedServletContainerFactory.addContextCustomizers(
                        new ServletContainerCustomizer());
            }
        }
    };
}
项目:various_demos    文件:EmbeddedTomcatConfig.java   
@Bean
public EmbeddedServletContainerCustomizer embeddedServletContainerCustomizer() {
    return new EmbeddedServletContainerCustomizer() {
        @Value("${application.port}")
        private int embeddedServletContainerListenPort;

        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {
            if (container instanceof TomcatEmbeddedServletContainerFactory) {
                TomcatEmbeddedServletContainerFactory tomcatEmbeddedServletContainerFactory = 
                        (TomcatEmbeddedServletContainerFactory) container;
                if (embeddedServletContainerListenPort <= 1024 ||  embeddedServletContainerListenPort > 65535) {
                    throw new IllegalArgumentException("The value of \"application.port\" in the properties file is invalid.");
                }

                tomcatEmbeddedServletContainerFactory.setPort(embeddedServletContainerListenPort);
            }
        }
    };
}
项目:apollo    文件:TomcatContainerCustomizer.java   
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
  if (!(container instanceof TomcatEmbeddedServletContainerFactory)) {
    return;
  }
  if (!environment.containsProperty(TOMCAT_ACCEPTOR_COUNT)) {
    return;
  }
  TomcatEmbeddedServletContainerFactory tomcat =
      (TomcatEmbeddedServletContainerFactory) container;
  tomcat.addConnectorCustomizers(new TomcatConnectorCustomizer() {
    @Override
    public void customize(Connector connector) {
      ProtocolHandler handler = connector.getProtocolHandler();
      if (handler instanceof Http11NioProtocol) {
        Http11NioProtocol http = (Http11NioProtocol) handler;
        int acceptCount = Integer.parseInt(environment.getProperty(TOMCAT_ACCEPTOR_COUNT));
        http.setBacklog(acceptCount);
        logger.info("Setting tomcat accept count to {}", acceptCount);
      }

    }
  });
}
项目:metasfresh-webui-api    文件:WebRestApiApplication.java   
@Bean
public EmbeddedServletContainerCustomizer servletContainerCustomizer()
{
    return new EmbeddedServletContainerCustomizer()
    {
        @Override
        public void customize(final ConfigurableEmbeddedServletContainer servletContainer)
        {
            final TomcatEmbeddedServletContainerFactory tomcatContainerFactory = (TomcatEmbeddedServletContainerFactory)servletContainer;
            tomcatContainerFactory.addConnectorCustomizers(new TomcatConnectorCustomizer()
            {
                @Override
                public void customize(final Connector connector)
                {
                    final AbstractHttp11Protocol<?> httpProtocol = (AbstractHttp11Protocol<?>)connector.getProtocolHandler();
                    httpProtocol.setCompression("on");
                    httpProtocol.setCompressionMinSize(256);
                    final String mimeTypes = httpProtocol.getCompressibleMimeType();
                    final String mimeTypesWithJson = mimeTypes + "," + MediaType.APPLICATION_JSON_VALUE + ",application/javascript";
                    httpProtocol.setCompressibleMimeType(mimeTypesWithJson);
                }
            });
        }
    };
}
项目:jhipster-ribbon-hystrix    文件:WebConfigurer.java   
/**
 * Set up Mime types and, if needed, set the document root.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);

    // When running in an IDE or with ./gradlew bootRun, set location of the static web assets.
    File root;
    if (env.acceptsProfiles(Constants.SPRING_PROFILE_PRODUCTION)) {
        root = new File("build/www/");
    } else {
        root = new File("src/main/webapp/");
    }
    if (root.exists() && root.isDirectory()) {
        container.setDocumentRoot(root);
    }
}
项目:jhipster-ribbon-hystrix    文件:_WebConfigurer.java   
/**
 * Set up Mime types and, if needed, set the document root.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);<% if (!skipClient) { %>

    // When running in an IDE or with <% if (buildTool == 'gradle') { %>./gradlew bootRun<% } else { %>./mvnw spring-boot:run<% } %>, set location of the static web assets.
    File root;
    if (env.acceptsProfiles(Constants.SPRING_PROFILE_PRODUCTION)) {
        root = new File("<%= CLIENT_DIST_DIR %>");
    } else {
        root = new File("<%= CLIENT_MAIN_SRC_DIR %>");
    }
    if (root.exists() && root.isDirectory()) {
        container.setDocumentRoot(root);
    }<% } %>
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:EndpointWebMvcChildContextConfiguration.java   
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    if (this.managementServerProperties == null) {
        this.managementServerProperties = BeanFactoryUtils
                .beanOfTypeIncludingAncestors(this.beanFactory,
                        ManagementServerProperties.class);
        this.server = BeanFactoryUtils.beanOfTypeIncludingAncestors(
                this.beanFactory, ServerProperties.class);
    }
    // Customize as per the parent context first (so e.g. the access logs go to
    // the same place)
    this.server.customize(container);
    // Then reset the error pages
    container.setErrorPages(Collections.<ErrorPage>emptySet());
    // and the context path
    container.setContextPath("");
    // and add the management-specific bits
    container.setPort(this.managementServerProperties.getPort());
    if (this.managementServerProperties.getSsl() != null) {
        container.setSsl(this.managementServerProperties.getSsl());
    }
    container.setServerHeader(this.server.getServerHeader());
    container.setAddress(this.managementServerProperties.getAddress());
    container.addErrorPages(new ErrorPage(this.server.getError().getPath()));
}
项目:findlunch    文件:Beans.java   
/**
 * Container customizer. Configures the embedded tomcat (e.g. post size)
 *
 * @return the embedded servlet container customizer
 * @throws Exception the exception
 */
@Bean 
public EmbeddedServletContainerCustomizer containerCustomizer(
        ) throws Exception {


      return new EmbeddedServletContainerCustomizer() {
        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {

              if (container instanceof TomcatEmbeddedServletContainerFactory) {

                  TomcatEmbeddedServletContainerFactory tomcat = (TomcatEmbeddedServletContainerFactory) container;
                  tomcat.addConnectorCustomizers(
                          new TomcatConnectorCustomizer() {
                            @Override
                            public void customize(Connector connector) {
                                  connector.setMaxPostSize(20000000);//20MB
                              }
                        }
                  );
              }
          }
    };
  }
项目:haven-platform    文件:SslServletContainerCustomizer.java   
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    KeystoreConfig cert = configureKeystore();
    if(cert == null) {
        log.debug("Ssl is not enabled due to no any configured keystore.");
        return;
    }
    String keystorePath = cert.getKeystore().getAbsolutePath();
    log.debug("Configure ssl with {} keystore.", keystorePath);
    Ssl ssl = new Ssl();
    ssl.setEnabled(true);
    ssl.setKeyStore(keystorePath);
    ssl.setKeyStorePassword(cert.getKeystorePassword());
    ssl.setKeyPassword(cert.getKeyPassword());
    container.setSsl(ssl);
}
项目:MicroBlog    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);
    // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
    setLocationForStaticAssets(container);

       /*
        * Enable HTTP/2 for Undertow - https://twitter.com/ankinson/status/829256167700492288
        * HTTP/2 requires HTTPS, so HTTP requests will fallback to HTTP/1.1.
        * See the JHipsterProperties class and your application-*.yml configuration files
        * for more information.
        */
    if (jHipsterProperties.getHttp().getVersion().equals(JHipsterProperties.Http.Version.V_2_0) &&
        container instanceof UndertowEmbeddedServletContainerFactory) {

        ((UndertowEmbeddedServletContainerFactory) container)
            .addBuilderCustomizers(builder ->
                builder.setServerOption(UndertowOptions.ENABLE_HTTP2, true));
    }
}
项目:spring-boot-concourse    文件:EndpointWebMvcChildContextConfiguration.java   
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    if (this.managementServerProperties == null) {
        this.managementServerProperties = BeanFactoryUtils
                .beanOfTypeIncludingAncestors(this.beanFactory,
                        ManagementServerProperties.class);
        this.server = BeanFactoryUtils.beanOfTypeIncludingAncestors(
                this.beanFactory, ServerProperties.class);
    }
    // Customize as per the parent context first (so e.g. the access logs go to
    // the same place)
    this.server.customize(container);
    // Then reset the error pages
    container.setErrorPages(Collections.<ErrorPage>emptySet());
    // and the context path
    container.setContextPath("");
    // and add the management-specific bits
    container.setPort(this.managementServerProperties.getPort());
    container.setServerHeader(this.server.getServerHeader());
    container.setAddress(this.managementServerProperties.getAddress());
    container.addErrorPages(new ErrorPage(this.server.getError().getPath()));
}
项目:contestparser    文件:EndpointWebMvcChildContextConfiguration.java   
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    if (this.managementServerProperties == null) {
        this.managementServerProperties = BeanFactoryUtils
                .beanOfTypeIncludingAncestors(this.beanFactory,
                        ManagementServerProperties.class);
        this.server = BeanFactoryUtils.beanOfTypeIncludingAncestors(
                this.beanFactory, ServerProperties.class);
    }
    // Customize as per the parent context first (so e.g. the access logs go to
    // the same place)
    this.server.customize(container);
    // Then reset the error pages
    container.setErrorPages(Collections.<ErrorPage>emptySet());
    // and add the management-specific bits
    container.setPort(this.managementServerProperties.getPort());
    container.setAddress(this.managementServerProperties.getAddress());
    container.addErrorPages(new ErrorPage(this.server.getError().getPath()));
}
项目:metadatamanagement    文件:WebConfigurer.java   
/**
 * Set up Mime types.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
  MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
  // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
  mappings.add("html", "text/html;charset=utf-8");
  // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
  mappings.add("json", "text/html;charset=utf-8");

  mappings.add("svg", "image/svg+xml");
  mappings.add("ttf", "application/x-font-ttf");
  mappings.add("otf", "application/x-font-opentype");
  mappings.add("woff", "application/font-woff");
  mappings.add("woff2", "application/font-woff2");
  mappings.add("eot", "application/vnd.ms-fontobject");
  mappings.add("sfnt", "application/font-sfnt");
  mappings.add("odt", "application/vnd.oasis.opendocument.text");
  mappings.add("pdf", "application/pdf");
  mappings.add("jpg", "image/jpeg");
  mappings.add("jpeg", "image/jpeg");
  mappings.add("png", "image/png");
  mappings.add("gif", "image/gif");

  container.setMimeMappings(mappings);
}
项目:recaptcha-spring-boot-starter    文件:TestApplication.java   
@Bean
public EmbeddedServletContainerCustomizer customizer() {
    return new EmbeddedServletContainerCustomizer() {

        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {
            TomcatEmbeddedServletContainerFactory tomcat = (TomcatEmbeddedServletContainerFactory) container;
            TomcatContextCustomizer contextCustomizer = new TomcatContextCustomizer() {

                @Override
                public void customize(Context context) {
                    context.setCookieProcessor(new LegacyCookieProcessor());
                }
            };
            tomcat.addContextCustomizers(contextCustomizer);
        }
    };
}
项目:Midaat-Vaccination-Microservice    文件:SSLEnabledServletContainer.java   
@Override
public void customize(ConfigurableEmbeddedServletContainer configurableEmbeddedServletContainer) {
    final String absoluteKeystoreFile;
    try {
        absoluteKeystoreFile = keystoreFile.getFile().getAbsolutePath();
        TomcatEmbeddedServletContainerFactory tomcat = (TomcatEmbeddedServletContainerFactory) configurableEmbeddedServletContainer;
        tomcat.addConnectorCustomizers(
                (connector) -> {
                    connector.setPort(port);
                    connector.setSecure(true);
                    connector.setScheme("https");

                    Http11NioProtocol proto = (Http11NioProtocol) connector.getProtocolHandler();
                    proto.setSSLEnabled(true);
                    proto.setKeystoreFile(absoluteKeystoreFile);
                    proto.setKeystorePass(keystorePass);
                    proto.setKeystoreType("PKCS12");
                    proto.setKeyAlias("tomcat");
                }
        );
    } catch (IOException e) {
    }
}
项目:booties    文件:ProxiesAutoConfiguration.java   
@Bean
public EmbeddedServletContainerCustomizer embeddedServletContainerCustomizer() {

    return new EmbeddedServletContainerCustomizer() {

        @Override
        public void customize(final ConfigurableEmbeddedServletContainer container) {
            if (container instanceof TomcatEmbeddedServletContainerFactory) {
                TomcatEmbeddedServletContainerFactory tomcat = (TomcatEmbeddedServletContainerFactory) container;
                for (TomcatConnectorCustomizer customizer : tomcatConnectorCustomizers) {
                    tomcat.addConnectorCustomizers(customizer);
                }
            }
        }
    };
}
项目:midpoint    文件:MidPointSpringApplication.java   
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    super.customize(container);

    container.addErrorPages(new ErrorPage(HttpStatus.UNAUTHORIZED,
            "/error/401"));
    container.addErrorPages(new ErrorPage(HttpStatus.FORBIDDEN,
            "/error/403"));
    container.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND,
            "/error/404"));
    container.addErrorPages(new ErrorPage(HttpStatus.GONE,
            "/error/410"));
    container.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR,
            "/error"));

    container.setSessionTimeout(sessionTimeout, TimeUnit.MINUTES);
}
项目:midpoint    文件:MidPointSpringApplication.java   
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    super.customize(container);

    container.addErrorPages(new ErrorPage(HttpStatus.UNAUTHORIZED,
            "/error/401"));
    container.addErrorPages(new ErrorPage(HttpStatus.FORBIDDEN,
            "/error/403"));
    container.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND,
            "/error/404"));
    container.addErrorPages(new ErrorPage(HttpStatus.GONE,
            "/error/410"));
    container.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR,
            "/error"));

    container.setSessionTimeout(sessionTimeout, TimeUnit.MINUTES);
}
项目:pyblog    文件:WebConfig.java   
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {

  return new EmbeddedServletContainerCustomizer() {
    @Override
    public void customize(ConfigurableEmbeddedServletContainer container) {
      ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/404.html");
      container.addErrorPages(error404Page);
    }
  };
}
项目:buenojo    文件:WebConfigurer.java   
/**
 * Set up Mime types.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);

}
项目:RoboInsta    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);
}
项目:fiery    文件:RagnarApplication.java   
@Bean
EmbeddedServletContainerCustomizer containerCustomizer() throws Exception {
    return (ConfigurableEmbeddedServletContainer container) -> {
        if (container instanceof TomcatEmbeddedServletContainerFactory) {
            TomcatEmbeddedServletContainerFactory tomcat = (TomcatEmbeddedServletContainerFactory) container;
            tomcat.addConnectorCustomizers(
                    (connector) -> {
                        connector.setMaxPostSize(1000000000); // 1000 MB
                    }
            );
        }
    };
}
项目:SpringBootDemoApp    文件:WebConfigurer.java   
/**
 * Customize the Servlet engine: Mime types, the document root, the cache.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    mappings.add("html", "text/html;charset=utf-8");
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);
    // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
    setLocationForStaticAssets(container);
}
项目:uckefu    文件:Application.java   
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {

    return new EmbeddedServletContainerCustomizer() {
        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {

            ErrorPage error = new ErrorPage("/error.html");

            container.addErrorPages(error);
        }
    };
}
项目:shoucang    文件:WebConfigurer.java   
/**
 * Set up Mime types.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);
}
项目:ProxyPool    文件:ErrorPageConfig.java   
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    ErrorPage error400Page = new ErrorPage(HttpStatus.BAD_REQUEST, "/400.html");
    ErrorPage error401Page = new ErrorPage(HttpStatus.UNAUTHORIZED, "/401.html");
    ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/404.html");
    ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500.html");

    container.addErrorPages(error400Page, error401Page, error404Page, error500Page);
}
项目:easyweb    文件:WebConfig.java   
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {

    return new EmbeddedServletContainerCustomizer() {
        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {
            ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/404");
            ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/500");
            container.addErrorPages(error404Page);
            container.addErrorPages(error500Page);
        }
    };
}
项目:angit    文件:ContainerAccessLogCustomizer.java   
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    if (container instanceof TomcatEmbeddedServletContainerFactory) {
        TomcatEmbeddedServletContainerFactory containerFactory = (TomcatEmbeddedServletContainerFactory) container;

        //访问日志设置
        LogbackValve logbackValve = new LogbackValve();
        logbackValve.setQuiet(true);
        logbackValve.setFilename(logbackAccessFile);
        containerFactory.addContextValves(logbackValve);
    }
}
项目:seldon-core    文件:App.java   
@Bean
public EmbeddedServletContainerCustomizer tomcatCustomizer() {
    return new EmbeddedServletContainerCustomizer() {

        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {
            if (container instanceof TomcatEmbeddedServletContainerFactory) {
                ((TomcatEmbeddedServletContainerFactory) container)
                        .addConnectorCustomizers(gracefulShutdown());
            }

        }
    };
}
项目:seldon-core    文件:App.java   
@Bean
public EmbeddedServletContainerCustomizer tomcatCustomizer() {
    return new EmbeddedServletContainerCustomizer() {

        @Override
        public void customize(ConfigurableEmbeddedServletContainer container) {
            if (container instanceof TomcatEmbeddedServletContainerFactory) {
                ((TomcatEmbeddedServletContainerFactory) container)
                        .addConnectorCustomizers(gracefulShutdown());
            }

        }
    };
}
项目:proxyee-down    文件:HttpDownServer.java   
@Override
public void customize(ConfigurableEmbeddedServletContainer configurableEmbeddedServletContainer) {
  if ("dev".equals(active)) {
    configurableEmbeddedServletContainer.setPort(tomcatServerPort);
  } else {
    configurableEmbeddedServletContainer.setPort(VIEW_SERVER_PORT);
  }
}
项目:ait-platform    文件:AitTomcatCustomizer.java   
@Override
public void customize(ConfigurableEmbeddedServletContainer configurableEmbeddedServletContainer) {
    configurableEmbeddedServletContainer.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/error404"));
    configurableEmbeddedServletContainer.addErrorPages(new ErrorPage(HttpStatus.FORBIDDEN, "/error403"));

    Compression compression = new Compression();
    compression.setEnabled(true);

    compression.setMimeTypes(mimeTypes);
    configurableEmbeddedServletContainer.setCompression(compression);
}
项目:klask-io    文件:WebConfigurer.java   
/**
 * Set up Mime types and, if needed, set the document root.
 */
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
    MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
    // IE issue, see https://github.com/jhipster/generator-jhipster/pull/711
    mappings.add("html", "text/html;charset=utf-8");
    // CloudFoundry issue, see https://github.com/cloudfoundry/gorouter/issues/64
    mappings.add("json", "text/html;charset=utf-8");
    container.setMimeMappings(mappings);

    // When running in an IDE or with ./mvnw spring-boot:run, set location of the static web assets.
    setLocationForStaticAssets(container);
}