本文整理汇总了Java中org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer.addErrorPages方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurableEmbeddedServletContainer.addErrorPages方法的具体用法?Java ConfigurableEmbeddedServletContainer.addErrorPages怎么用?Java ConfigurableEmbeddedServletContainer.addErrorPages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer
的用法示例。
在下文中一共展示了ConfigurableEmbeddedServletContainer.addErrorPages方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: customize
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
@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()));
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:26,代码来源:EndpointWebMvcChildContextConfiguration.java
示例2: containerCustomizer
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
@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);
// });
}
示例3: customize
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
@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()));
}
示例4: customize
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
@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()));
}
示例5: customize
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
@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);
}
示例6: containerCustomizer
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
@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);
}
};
}
示例7: containerCustomizer
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
return new EmbeddedServletContainerCustomizer() {
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
ErrorPage error = new ErrorPage("/error.html");
container.addErrorPages(error);
}
};
}
示例8: customize
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
@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);
}
示例9: containerCustomizer
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
@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);
}
};
}
示例10: customize
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
@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);
}
示例11: customize
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
//404错误页面
container.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/error/notFound"));
//500错误页面
container.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/error/serverError"));
//500错误页面
container.addErrorPages(new ErrorPage(HttpStatus.UNAUTHORIZED, "/unauthorized"));
}
示例12: containerCustomizer
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
return new EmbeddedServletContainerCustomizer() {
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/pageNotFound");
container.addErrorPages(error404Page);
}
};
}
示例13: containerCustomizer
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
return new EmbeddedServletContainerCustomizer() {
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/web/error/404");
container.addErrorPages(error404Page);
}
};
}
示例14: containerCustomizer
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer() {
return new EmbeddedServletContainerCustomizer() {
@Override
public void customize(ConfigurableEmbeddedServletContainer 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);
}
};
}
示例15: containerCustomizer
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; //导入方法依赖的package包/类
@Bean
public EmbeddedServletContainerCustomizer containerCustomizer(){
return new EmbeddedServletContainerCustomizer(){
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
container.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/error/404"));
container.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/error/500"));
container.addErrorPages(new ErrorPage(java.lang.Throwable.class,"/error/500"));
}
};
}