当前位置: 首页>>代码示例>>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;未经允许,请勿转载。