當前位置: 首頁>>代碼示例>>Java>>正文


Java ConfigurableEmbeddedServletContainer.addErrorPages方法代碼示例

本文整理匯總了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);
//        });
    }
 
開發者ID:baidao,項目名稱:tinker-manager,代碼行數:18,代碼來源:WebAppConfig.java

示例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()));
}
 
開發者ID:philwebb,項目名稱:spring-boot-concourse,代碼行數:23,代碼來源:EndpointWebMvcChildContextConfiguration.java

示例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()));
}
 
開發者ID:Nephilim84,項目名稱:contestparser,代碼行數:20,代碼來源:EndpointWebMvcChildContextConfiguration.java

示例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);
}
 
開發者ID:Evolveum,項目名稱:midpoint,代碼行數:18,代碼來源:MidPointSpringApplication.java

示例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);
    }
  };
}
 
開發者ID:tomoya92,項目名稱:pyblog,代碼行數:12,代碼來源:WebConfig.java

示例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);
        }
    };
}
 
開發者ID:uckefu,項目名稱:uckefu,代碼行數:14,代碼來源:Application.java

示例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);
}
 
開發者ID:fengzhizi715,項目名稱:ProxyPool,代碼行數:10,代碼來源:ErrorPageConfig.java

示例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);
        }
    };
}
 
開發者ID:egojit8,項目名稱:easyweb,代碼行數:14,代碼來源:WebConfig.java

示例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);
}
 
開發者ID:allianzit,項目名稱:ait-platform,代碼行數:12,代碼來源:AitTomcatCustomizer.java

示例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"));
}
 
開發者ID:egzosn,項目名稱:spring-jdbc-orm,代碼行數:10,代碼來源:ErrorPageConfig.java

示例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);
        }
    };
}
 
開發者ID:fku233,項目名稱:MBLive,代碼行數:11,代碼來源:WebConfig.java

示例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);
        }
    };
}
 
開發者ID:castlemock,項目名稱:castlemock,代碼行數:13,代碼來源:ErrorComponent.java

示例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);
        }
    };
}
 
開發者ID:QianWorks,項目名稱:qianworks-meican,代碼行數:16,代碼來源:GenericConfig.java

示例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"));
		}
	};
}
 
開發者ID:whatlookingfor,項目名稱:spring-boot-sample,代碼行數:12,代碼來源:ExceptionMvcAutoConfiguration.java


注:本文中的org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer.addErrorPages方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。