本文整理匯總了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"));
}
};
}