• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java DelegatingFilterProxyRegistrationBean类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean的典型用法代码示例。如果您正苦于以下问题:Java DelegatingFilterProxyRegistrationBean类的具体用法?Java DelegatingFilterProxyRegistrationBean怎么用?Java DelegatingFilterProxyRegistrationBean使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

DelegatingFilterProxyRegistrationBean类属于org.springframework.boot.web.servlet包,在下文中一共展示了DelegatingFilterProxyRegistrationBean类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: delegatingFilterProxyRegistrationBeansSkipsTargetBeanNames

点赞 3

import org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean; //导入依赖的package包/类
@Test
public void delegatingFilterProxyRegistrationBeansSkipsTargetBeanNames()
		throws Exception {
	addEmbeddedServletContainerFactoryBean();
	DelegatingFilterProxyRegistrationBean initializer = new DelegatingFilterProxyRegistrationBean(
			"filterBean");
	this.context.registerBeanDefinition("initializerBean",
			beanDefinition(initializer));
	BeanDefinition filterBeanDefinition = beanDefinition(
			new IllegalStateException("Create FilterBean Failure"));
	filterBeanDefinition.setLazyInit(true);
	this.context.registerBeanDefinition("filterBean", filterBeanDefinition);
	this.context.refresh();
	ServletContext servletContext = getEmbeddedServletContainerFactory()
			.getServletContext();
	verify(servletContext, atMost(1)).addFilter(anyString(),
			this.filterCaptor.capture());
	// Up to this point the filterBean should not have been created, calling
	// the delegate proxy will trigger creation and an exception
	this.thrown.expect(BeanCreationException.class);
	this.thrown.expectMessage("Create FilterBean Failure");
	this.filterCaptor.getValue().init(new MockFilterConfig());
	this.filterCaptor.getValue().doFilter(new MockHttpServletRequest(),
			new MockHttpServletResponse(), new MockFilterChain());
}
 

开发者ID:vikrammane23,
项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,
代码行数:26,
代码来源:EmbeddedWebApplicationContextTests.java

示例2: defaultFilterDispatcherTypes

点赞 3

import org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean; //导入依赖的package包/类
@Test
public void defaultFilterDispatcherTypes() {
	this.context = new AnnotationConfigWebApplicationContext();
	this.context.setServletContext(new MockServletContext());
	this.context.register(SecurityAutoConfiguration.class,
			SecurityFilterAutoConfiguration.class,
			ServerPropertiesAutoConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class);
	this.context.refresh();
	DelegatingFilterProxyRegistrationBean bean = this.context.getBean(
			"securityFilterChainRegistration",
			DelegatingFilterProxyRegistrationBean.class);
	@SuppressWarnings("unchecked")
	EnumSet<DispatcherType> dispatcherTypes = (EnumSet<DispatcherType>) ReflectionTestUtils
			.getField(bean, "dispatcherTypes");
	assertThat(dispatcherTypes).isNull();
}
 

开发者ID:vikrammane23,
项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,
代码行数:18,
代码来源:SecurityAutoConfigurationTests.java

示例3: customFilterDispatcherTypes

点赞 3

import org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean; //导入依赖的package包/类
@Test
public void customFilterDispatcherTypes() {
	this.context = new AnnotationConfigWebApplicationContext();
	this.context.setServletContext(new MockServletContext());
	this.context.register(SecurityAutoConfiguration.class,
			SecurityFilterAutoConfiguration.class,
			ServerPropertiesAutoConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class);
	EnvironmentTestUtils.addEnvironment(this.context,
			"security.filter-dispatcher-types:INCLUDE,ERROR");
	this.context.refresh();
	DelegatingFilterProxyRegistrationBean bean = this.context.getBean(
			"securityFilterChainRegistration",
			DelegatingFilterProxyRegistrationBean.class);
	@SuppressWarnings("unchecked")
	EnumSet<DispatcherType> dispatcherTypes = (EnumSet<DispatcherType>) ReflectionTestUtils
			.getField(bean, "dispatcherTypes");
	assertThat(dispatcherTypes).containsOnly(DispatcherType.INCLUDE,
			DispatcherType.ERROR);
}
 

开发者ID:vikrammane23,
项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,
代码行数:21,
代码来源:SecurityAutoConfigurationTests.java

示例4: securityFilterChainRegistration

点赞 3

import org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean; //导入依赖的package包/类
@Bean
@ConditionalOnBean(name = DEFAULT_FILTER_NAME)
public DelegatingFilterProxyRegistrationBean securityFilterChainRegistration(
		SecurityProperties securityProperties) {
	DelegatingFilterProxyRegistrationBean registration = new DelegatingFilterProxyRegistrationBean(
			DEFAULT_FILTER_NAME);
	registration.setOrder(securityProperties.getFilterOrder());
	registration.setDispatcherTypes(getDispatcherTypes(securityProperties));
	return registration;
}
 

开发者ID:vikrammane23,
项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,
代码行数:11,
代码来源:SecurityFilterAutoConfiguration.java

示例5: delegatingFilterProxyRegistrationBean

点赞 2

import org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean; //导入依赖的package包/类
@Bean
DelegatingFilterProxyRegistrationBean delegatingFilterProxyRegistrationBean() {
  DelegatingFilterProxyRegistrationBean bean = new DelegatingFilterProxyRegistrationBean("traceLoggingFilter");

  bean.setDispatcherTypes(ASYNC, ERROR, FORWARD, INCLUDE, REQUEST);
  bean.setOrder(Ordered.LOWEST_PRECEDENCE);
  return bean;
}
 

开发者ID:apache,
项目名称:incubator-servicecomb-java-chassis,
代码行数:9,
代码来源:LoggingFilterConfig.java

示例6: addFilters

点赞 2

import org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean; //导入依赖的package包/类
private void addFilters(ConfigurableMockMvcBuilder<?> builder) {
	ServletContextInitializerBeans Initializers = new ServletContextInitializerBeans(
			this.context);
	for (ServletContextInitializer initializer : Initializers) {
		if (initializer instanceof FilterRegistrationBean) {
			addFilter(builder, (FilterRegistrationBean) initializer);
		}
		if (initializer instanceof DelegatingFilterProxyRegistrationBean) {
			addFilter(builder, (DelegatingFilterProxyRegistrationBean) initializer);
		}
	}
}
 

开发者ID:vikrammane23,
项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,
代码行数:13,
代码来源:SpringBootMockMvcBuilderCustomizer.java

示例7: testDefaultFilterOrderWithSecurityAdapter

点赞 2

import org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean; //导入依赖的package包/类
@Test
public void testDefaultFilterOrderWithSecurityAdapter() throws Exception {
	this.context = new AnnotationConfigWebApplicationContext();
	this.context.setServletContext(new MockServletContext());
	this.context.register(WebSecurity.class, SecurityAutoConfiguration.class,
			SecurityFilterAutoConfiguration.class,
			ServerPropertiesAutoConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class);
	this.context.refresh();
	assertThat(this.context.getBean("securityFilterChainRegistration",
			DelegatingFilterProxyRegistrationBean.class).getOrder()).isEqualTo(
					FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER - 100);
}
 

开发者ID:vikrammane23,
项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,
代码行数:14,
代码来源:SecurityAutoConfigurationTests.java

示例8: testDefaultFilterOrder

点赞 2

import org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean; //导入依赖的package包/类
@Test
public void testDefaultFilterOrder() throws Exception {
	this.context = new AnnotationConfigWebApplicationContext();
	this.context.setServletContext(new MockServletContext());
	this.context.register(SecurityAutoConfiguration.class,
			SecurityFilterAutoConfiguration.class,
			ServerPropertiesAutoConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class);
	this.context.refresh();
	assertThat(this.context.getBean("securityFilterChainRegistration",
			DelegatingFilterProxyRegistrationBean.class).getOrder()).isEqualTo(
					FilterRegistrationBean.REQUEST_WRAPPER_FILTER_MAX_ORDER - 100);
}
 

开发者ID:vikrammane23,
项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,
代码行数:14,
代码来源:SecurityAutoConfigurationTests.java

示例9: testCustomFilterOrder

点赞 2

import org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean; //导入依赖的package包/类
@Test
public void testCustomFilterOrder() throws Exception {
	this.context = new AnnotationConfigWebApplicationContext();
	EnvironmentTestUtils.addEnvironment(this.context, "security.filter-order:12345");
	this.context.setServletContext(new MockServletContext());
	this.context.register(SecurityAutoConfiguration.class,
			SecurityFilterAutoConfiguration.class,
			ServerPropertiesAutoConfiguration.class,
			PropertyPlaceholderAutoConfiguration.class);
	this.context.refresh();
	assertThat(this.context.getBean("securityFilterChainRegistration",
			DelegatingFilterProxyRegistrationBean.class).getOrder()).isEqualTo(12345);
}
 

开发者ID:vikrammane23,
项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,
代码行数:14,
代码来源:SecurityAutoConfigurationTests.java

示例10: userInsertingMdcFilterRegistrationBean

点赞 2

import org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean; //导入依赖的package包/类
@Bean
public DelegatingFilterProxyRegistrationBean userInsertingMdcFilterRegistrationBean() {
    DelegatingFilterProxyRegistrationBean registrationBean = new DelegatingFilterProxyRegistrationBean("hystrixRequestContextEnablerFilter", new ServletRegistrationBean[0]);
    registrationBean.setOrder(Integer.MAX_VALUE - 1);
    return registrationBean;
}
 

开发者ID:zhaoqilong3031,
项目名称:spring-cloud-samples,
代码行数:7,
代码来源:HystrixPluginsConfig.java

示例11: setterInsertingMdcFilterRegistrationBean

点赞 2

import org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean; //导入依赖的package包/类
@Bean
public DelegatingFilterProxyRegistrationBean setterInsertingMdcFilterRegistrationBean() {
    DelegatingFilterProxyRegistrationBean registrationBean = new DelegatingFilterProxyRegistrationBean("securityContextHystrixRequestVariableSetterFilter", new ServletRegistrationBean[0]);
    registrationBean.setOrder(Integer.MAX_VALUE);
    return registrationBean;
}
 

开发者ID:zhaoqilong3031,
项目名称:spring-cloud-samples,
代码行数:7,
代码来源:HystrixPluginsConfig.java

示例12: addFilter

点赞 2

import org.springframework.boot.web.servlet.DelegatingFilterProxyRegistrationBean; //导入依赖的package包/类
private void addFilter(ConfigurableMockMvcBuilder<?> builder,
		DelegatingFilterProxyRegistrationBean registration) {
	addFilter(builder, registration.getFilter(), registration.getUrlPatterns());
}
 

开发者ID:vikrammane23,
项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,
代码行数:5,
代码来源:SpringBootMockMvcBuilderCustomizer.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)