本文整理了Java中com.netflix.zuul.ZuulApplicationInfo
类的一些代码示例,展示了ZuulApplicationInfo
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZuulApplicationInfo
类的具体详情如下:
包路径:com.netflix.zuul.ZuulApplicationInfo
类名称:ZuulApplicationInfo
[英]Metadata about the Zuul instance/ application name and "stack"
[中]关于Zuul实例/应用程序名和“堆栈”的元数据
代码示例来源:origin: Netflix/zuul
/**
* verifies compilation, instanciation and that it is a ZuulFilter
*
* @param sFilterCode
* @return a FilterInfo object representing that code
* @throws org.codehaus.groovy.control.CompilationFailedException
*
* @throws IllegalAccessException
* @throws InstantiationException
*/
public FilterInfo verifyFilter(String sFilterCode) throws org.codehaus.groovy.control.CompilationFailedException, IllegalAccessException, InstantiationException {
Class groovyClass = compileGroovy(sFilterCode);
Object instance = instanciateClass(groovyClass);
checkZuulFilterInstance(instance);
BaseFilter filter = (BaseFilter) instance;
String filter_id = FilterInfo.buildFilterID(ZuulApplicationInfo.getApplicationName(), filter.filterType(), groovyClass.getSimpleName());
return new FilterInfo(filter_id, sFilterCode, filter.filterType(), groovyClass.getSimpleName(), filter.disablePropertyName(), "" + filter.filterOrder(), ZuulApplicationInfo.getApplicationName());
}
代码示例来源:origin: com.netflix.zuul/zuul-netflix
/**
* sets the application name of the origin
*
* @param applicationName
*/
public static void setApplicationName(String applicationName) {
RibbonConfig.APPLICATION_NAME = applicationName;
if (ZuulApplicationInfo.getApplicationName() == null) ZuulApplicationInfo.setApplicationName(applicationName);
LOG.info("Setting back end VIP application = " + applicationName);
}
代码示例来源:origin: com.netflix.zuul/zuul-netflix
@After
public void setZuulAppNameBack() {
ZuulApplicationInfo.setApplicationName(zuulAppName);
}
代码示例来源:origin: com.netflix.zuul/zuul-netflix
/**
* sets the default origin application stack
*
* @param stack
*/
public static void setApplicationStack(String stack) {
RibbonConfig.APPLICATION_STACK = stack;
if (ZuulApplicationInfo.getStack() == null) ZuulApplicationInfo.setStack(stack);
LOG.info("Setting back end VIP stack = " + stack);
}
代码示例来源:origin: com.netflix.zuul/zuul-netflix
@Test
public void defaultApplicationName() {
String applicationName = UUID.randomUUID().toString();
ZuulApplicationInfo.setApplicationName(applicationName);
FilterId filterId = new Builder().filterType("com.acme.None")
.filterName("none")
.build();
assertThat(filterId.toString(), is(applicationName + ":none:com.acme.None"));
}
}
代码示例来源:origin: Netflix/zuul
/**
* verifies compilation, instanciation and that it is a ZuulFilter
*
* @param sFilterCode
* @return a FilterInfo object representing that code
* @throws org.codehaus.groovy.control.CompilationFailedException
*
* @throws IllegalAccessException
* @throws InstantiationException
*/
public FilterInfo verifyFilter(String sFilterCode) throws org.codehaus.groovy.control.CompilationFailedException, IllegalAccessException, InstantiationException {
Class groovyClass = compileGroovy(sFilterCode);
Object instance = instanciateClass(groovyClass);
checkZuulFilterInstance(instance);
BaseFilter filter = (BaseFilter) instance;
String filter_id = FilterInfo.buildFilterID(ZuulApplicationInfo.getApplicationName(), filter.filterType(), groovyClass.getSimpleName());
return new FilterInfo(filter_id, sFilterCode, filter.filterType(), groovyClass.getSimpleName(), filter.disablePropertyName(), "" + filter.filterOrder(), ZuulApplicationInfo.getApplicationName());
}
代码示例来源:origin: com.netflix.zuul/zuul-servletapi
@WarmUp
public void initialize()
{
try {
RibbonConfig.setupAppInfo();
String stack = ConfigurationManager.getDeploymentContext().getDeploymentStack();
// Setup the default origin.
String defaultClientName;
if (stack != null && !stack.trim().isEmpty() && RibbonConfig.isAutodetectingBackendVips()) {
defaultClientName = RibbonConfig.setupDefaultRibbonConfig();
} else {
DynamicStringProperty DEFAULT_CLIENT = DynamicPropertyFactory.getInstance().getStringProperty(ZUUL_NIWS_DEFAULTCLIENT, null);
defaultClientName = DEFAULT_CLIENT.get();
if (defaultClientName == null) {
defaultClientName = stack;
}
ZuulApplicationInfo.setApplicationName(defaultClientName);
}
origins.put(defaultClientName, new RibbonOrigin(defaultClientName));
// Setup the other configured origins.
String clientPropertyList = DynamicPropertyFactory.getInstance().getStringProperty(ZUUL_NIWS_CLIENTLIST, "").get();
String[] aClientList = clientPropertyList.split("\\|");
for (String client : aClientList) {
initOrigin(RIBBON_NAMESPACE.get(), client);
}
}
catch (ClientException e) {
throw new ZuulException(e, "Error initializing Ribbon clients.");
}
}
代码示例来源:origin: com.netflix.zuul/zuul-netflix
private String getScriptsForFilterIndexKey(String filter_id) {
return SCRIPTS_FOR_FILTER + ZuulApplicationInfo.getApplicationName() + "_" + filter_id;
}
代码示例来源:origin: com.netflix.zuul/zuul-core
private String getScriptsForFilterIndexKey(String filter_id) {
return SCRIPTS_FOR_FILTER + ZuulApplicationInfo.getApplicationName() + "_" + filter_id;
}
代码示例来源:origin: com.netflix.zuul/zuul-core
@Override
public List<String> getAllFilterIDs() {
return getFilterIdsIndex(FILTER_ID + ZuulApplicationInfo.getApplicationName());
}
代码示例来源:origin: com.netflix.zuul/zuul-core
@Override
public List<FilterInfo> getAllActiveFilters() {
List<FilterInfo> filterInfos = getFiltersForIndex(ACTIVE_SCRIPTS + ZuulApplicationInfo.getApplicationName());
if (filterInfos == null || filterInfos.size() == 0) {
return Collections.emptyList();
} else {
Collections.sort(filterInfos);
return filterInfos;
}
}
代码示例来源:origin: com.netflix.zuul/zuul-netflix
@Override
public List<FilterInfo> getAllCanaryFilters() {
List<FilterInfo> filterInfos = getFiltersForIndex(CANARY_SCRIPTS + ZuulApplicationInfo.getApplicationName());
if (filterInfos == null || filterInfos.size() == 0) {
return Collections.emptyList();
} else {
Collections.sort(filterInfos);
return filterInfos;
}
}
代码示例来源:origin: com.netflix.zuul/zuul-core
@Override
public List<FilterInfo> getAllCanaryFilters() {
List<FilterInfo> filterInfos = getFiltersForIndex(CANARY_SCRIPTS + ZuulApplicationInfo.getApplicationName());
if (filterInfos == null || filterInfos.size() == 0) {
return Collections.emptyList();
} else {
Collections.sort(filterInfos);
return filterInfos;
}
}
代码示例来源:origin: com.netflix.zuul/zuul-netflix
@Override
public List<FilterInfo> getAllActiveFilters() {
List<FilterInfo> filterInfos = getFiltersForIndex(ACTIVE_SCRIPTS + ZuulApplicationInfo.getApplicationName());
if (filterInfos == null || filterInfos.size() == 0) {
return Collections.emptyList();
} else {
Collections.sort(filterInfos);
return filterInfos;
}
}
代码示例来源:origin: com.netflix.zuul/zuul-netflix
@Override
public List<String> getAllFilterIDs() {
return getFilterIdsIndex(FILTER_ID + ZuulApplicationInfo.getApplicationName());
}
代码示例来源:origin: com.netflix.zuul/zuul-core
public static String buildFilterID(FilterType filter_type, String filter_name) {
return FilterInfo.buildFilterID(ZuulApplicationInfo.getApplicationName(), filter_type, filter_name);
}
代码示例来源:origin: com.netflix.zuul/zuul-core
public FilterInfo getCanaryScriptForFilter(String filter_id) {
List<FilterInfo> filterInfos = getFiltersForIndex(CANARY_SCRIPTS + ZuulApplicationInfo.getApplicationName());
for (int i = 0; i < filterInfos.size(); i++) {
FilterInfo filterInfo = filterInfos.get(i);
if (filterInfo.getFilterID().equals(filter_id)) return filterInfo;
}
return null;
}
代码示例来源:origin: com.netflix.zuul/zuul-netflix
@Override
public FilterInfo getActiveFilterInfoForFilter(String filter_id) {
List<FilterInfo> filterInfos = getFiltersForIndex(ACTIVE_SCRIPTS + ZuulApplicationInfo.getApplicationName());
for (int i = 0; i < filterInfos.size(); i++) {
FilterInfo filterInfo = filterInfos.get(i);
if (filterInfo.getFilterID().equals(filter_id)) return filterInfo;
}
return null;
}
代码示例来源:origin: com.netflix.zuul/zuul-netflix
public FilterInfo getCanaryScriptForFilter(String filter_id) {
List<FilterInfo> filterInfos = getFiltersForIndex(CANARY_SCRIPTS + ZuulApplicationInfo.getApplicationName());
for (int i = 0; i < filterInfos.size(); i++) {
FilterInfo filterInfo = filterInfos.get(i);
if (filterInfo.getFilterID().equals(filter_id)) return filterInfo;
}
return null;
}
代码示例来源:origin: com.netflix.zuul/zuul-core
@Override
public FilterInfo getActiveFilterInfoForFilter(String filter_id) {
List<FilterInfo> filterInfos = getFiltersForIndex(ACTIVE_SCRIPTS + ZuulApplicationInfo.getApplicationName());
for (int i = 0; i < filterInfos.size(); i++) {
FilterInfo filterInfo = filterInfos.get(i);
if (filterInfo.getFilterID().equals(filter_id)) return filterInfo;
}
return null;
}
内容来源于网络,如有侵权,请联系作者删除!