當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。