当前位置: 首页>>代码示例>>Java>>正文


Java ZuulFilter类代码示例

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


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

示例1: createZuulFilter

import com.netflix.zuul.ZuulFilter; //导入依赖的package包/类
private ZuulFilter createZuulFilter(int position) {
	Integer filterCount = 0;
	if(properties.getFilters().size() >= (position+1)) {
		Bucket4JConfiguration filter = properties.getFilters().get(position);
		filterCount++;
		
		FilterConfiguration filterConfig = buildFilterConfig(filter, cacheManager, zuulExpressionParser(), beanFactory);
		
        return new ZuulRateLimitFilter(filterConfig);
	}
	
	return null;
}
 
开发者ID:MarcGiffing,项目名称:bucket4j-spring-boot-starter,代码行数:14,代码来源:Bucket4JAutoConfigurationZuul.java

示例2: invoke

import com.netflix.zuul.ZuulFilter; //导入依赖的package包/类
@ReadOperation
public Map<String, List<Map<String, Object>>> invoke() {
	// Map of filters by type
	final Map<String, List<Map<String, Object>>> filterMap = new TreeMap<>();

	for (ZuulFilter filter : this.filterRegistry.getAllFilters()) {
		// Ensure that we have a list to store filters of each type
		if (!filterMap.containsKey(filter.filterType())) {
			filterMap.put(filter.filterType(), new ArrayList<>());
		}

		final Map<String, Object> filterInfo = new LinkedHashMap<>();
		filterInfo.put("class", filter.getClass().getName());
		filterInfo.put("order", filter.filterOrder());
		filterInfo.put("disabled", filter.isFilterDisabled());
		filterInfo.put("static", filter.isStaticFilter());

		filterMap.get(filter.filterType()).add(filterInfo);
	}

	return filterMap;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:23,代码来源:FiltersEndpoint.java

示例3: sampleFilter

import com.netflix.zuul.ZuulFilter; //导入依赖的package包/类
@Bean
public ZuulFilter sampleFilter() {
	return new ZuulFilter() {
		@Override
		public String filterType() {
			return PRE_TYPE;
		}

		@Override
		public boolean shouldFilter() {
			return true;
		}

		@Override
		public Object run() {
			return null;
		}

		@Override
		public int filterOrder() {
			return 0;
		}
	};
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:25,代码来源:RetryableZuulProxyApplicationTests.java

示例4: sampleFilter

import com.netflix.zuul.ZuulFilter; //导入依赖的package包/类
@Bean
public ZuulFilter sampleFilter() {
	return new ZuulFilter() {

		@Override
		public String filterType() {
			return PRE_TYPE;
		}

		@Override
		public boolean shouldFilter() {
			return true;
		}

		@Override
		public Object run() {
			return null;
		}

		@Override
		public int filterOrder() {
			return 0;
		}

	};
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:27,代码来源:FormZuulProxyApplicationTests.java

示例5: rateLimiterPreFilter

import com.netflix.zuul.ZuulFilter; //导入依赖的package包/类
@Bean
public ZuulFilter rateLimiterPreFilter(final RateLimiter rateLimiter,
                                       final RateLimitProperties rateLimitProperties,
                                       final RouteLocator routeLocator,
                                       final RateLimitKeyGenerator rateLimitKeyGenerator) {
    return new RateLimitPreFilter(rateLimitProperties, routeLocator, urlPathHelper, rateLimiter,
            rateLimitKeyGenerator);
}
 
开发者ID:marcosbarbero,项目名称:spring-cloud-zuul-ratelimit,代码行数:9,代码来源:RateLimitAutoConfiguration.java

示例6: rateLimiterPostFilter

import com.netflix.zuul.ZuulFilter; //导入依赖的package包/类
@Bean
public ZuulFilter rateLimiterPostFilter(final RateLimiter rateLimiter,
                                        final RateLimitProperties rateLimitProperties,
                                        final RouteLocator routeLocator,
                                        final RateLimitKeyGenerator rateLimitKeyGenerator) {
    return new RateLimitPostFilter(rateLimitProperties, routeLocator, urlPathHelper, rateLimiter,
            rateLimitKeyGenerator);
}
 
开发者ID:marcosbarbero,项目名称:spring-cloud-zuul-ratelimit,代码行数:9,代码来源:RateLimitAutoConfiguration.java

示例7: testZuulFilters

import com.netflix.zuul.ZuulFilter; //导入依赖的package包/类
@Test
public void testZuulFilters() {
    this.context.refresh();

    Map<String, ZuulFilter> zuulFilterMap = context.getBeansOfType(ZuulFilter.class);
    assertThat(zuulFilterMap.size()).isEqualTo(2);
    assertThat(zuulFilterMap.keySet()).containsExactly("rateLimiterPreFilter", "rateLimiterPostFilter");
}
 
开发者ID:marcosbarbero,项目名称:spring-cloud-zuul-ratelimit,代码行数:9,代码来源:RateLimitAutoConfigurationTest.java

示例8: ZuulFilterInitializer

import com.netflix.zuul.ZuulFilter; //导入依赖的package包/类
public ZuulFilterInitializer(Map<String, ZuulFilter> filters,
							 CounterFactory counterFactory,
							 TracerFactory tracerFactory,
							 FilterLoader filterLoader,
							 FilterRegistry filterRegistry) {
	this.filters = filters;
	this.counterFactory = counterFactory;
	this.tracerFactory = tracerFactory;
	this.filterLoader = filterLoader;
	this.filterRegistry = filterRegistry;
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:12,代码来源:ZuulFilterInitializer.java

示例9: contextInitialized

import com.netflix.zuul.ZuulFilter; //导入依赖的package包/类
@PostConstruct
public void contextInitialized() {
	log.info("Starting filter initializer");

	TracerFactory.initialize(tracerFactory);
	CounterFactory.initialize(counterFactory);

	for (Map.Entry<String, ZuulFilter> entry : this.filters.entrySet()) {
		filterRegistry.put(entry.getKey(), entry.getValue());
	}
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:12,代码来源:ZuulFilterInitializer.java

示例10: contextDestroyed

import com.netflix.zuul.ZuulFilter; //导入依赖的package包/类
@PreDestroy
public void contextDestroyed() {
	log.info("Stopping filter initializer");
	for (Map.Entry<String, ZuulFilter> entry : this.filters.entrySet()) {
		filterRegistry.remove(entry.getKey());
	}
	clearLoaderCache();

	TracerFactory.initialize(null);
	CounterFactory.initialize(null);
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:12,代码来源:ZuulFilterInitializer.java

示例11: testPreFilter

import com.netflix.zuul.ZuulFilter; //导入依赖的package包/类
@Bean
public ZuulFilter testPreFilter() {
	return new FailureFilter() {
		@Override
		public String filterType() {
			return PRE_TYPE;
		}
	};
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:10,代码来源:SendErrorFilterIntegrationTests.java

示例12: testRouteFilter

import com.netflix.zuul.ZuulFilter; //导入依赖的package包/类
@Bean
public ZuulFilter testRouteFilter() {
	return new FailureFilter() {
		@Override
		public String filterType() {
			return ROUTE_TYPE;
		}
	};
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:10,代码来源:SendErrorFilterIntegrationTests.java

示例13: testPostFilter

import com.netflix.zuul.ZuulFilter; //导入依赖的package包/类
@Bean
public ZuulFilter testPostFilter() {
	return new FailureFilter() {
		@Override
		public String filterType() {
			return POST_TYPE;
		}
	};
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:10,代码来源:SendErrorFilterIntegrationTests.java

示例14: sampleFilter

import com.netflix.zuul.ZuulFilter; //导入依赖的package包/类
@Bean
public ZuulFilter sampleFilter() {
	return new ZuulFilter() {
		@Override
		public String filterType() {
			return PRE_TYPE;
		}

		@Override
		public boolean shouldFilter() {
			return true;
		}

		@Override
		public Object run() {
			if (RequestContext.getCurrentContext().getRequest().getParameterMap()
					.containsKey("override")) {
				Map<String, List<String>> overridden = new HashMap<>();
				overridden.put("key", Arrays.asList("overridden"));
				RequestContext.getCurrentContext()
						.setRequestQueryParams(overridden);
			}
			return null;
		}

		@Override
		public int filterOrder() {
			return 0;
		}
	};

}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:33,代码来源:ZuulProxyTestBase.java

示例15: zuulFilter1

import com.netflix.zuul.ZuulFilter; //导入依赖的package包/类
@Bean
@Conditional(ConfigCondition1.class)
public ZuulFilter zuulFilter1() {
	return createZuulFilter(0);
}
 
开发者ID:MarcGiffing,项目名称:bucket4j-spring-boot-starter,代码行数:6,代码来源:Bucket4JAutoConfigurationZuul.java


注:本文中的com.netflix.zuul.ZuulFilter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。