use of org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer in project microservices by pwillhan.
the class WebConfig method containerCustomizer.
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
return new EmbeddedServletContainerCustomizer() {
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
// TODO Auto-generated method stub
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);
}
};
}
use of org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer in project x-pipe by ctripcorp.
the class CustomizedConfig method containerCustomizer.
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
return new EmbeddedServletContainerCustomizer() {
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
ErrorPage error401Page = new ErrorPage(HttpStatus.UNAUTHORIZED, "/401.html");
container.addErrorPages(error401Page);
}
};
}
use of org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer in project metasfresh-webui-api by metasfresh.
the class WebRestApiApplication method servletContainerCustomizer.
@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);
}
});
}
};
}
Aggregations