Java Code Examples for com.netflix.config.DynamicStringProperty#get()

The following examples show how to use com.netflix.config.DynamicStringProperty#get() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SurgicalDebugFilter.java    From zuul with Apache License 2.0 6 votes vote down vote up
@Override
public HttpRequestMessage apply(HttpRequestMessage request) {
    DynamicStringProperty routeVip = new DynamicStringProperty(ZuulConstants.ZUUL_DEBUG_VIP, null);
    DynamicStringProperty routeHost = new DynamicStringProperty(ZuulConstants.ZUUL_DEBUG_HOST, null);

    SessionContext ctx = request.getContext();

    if (routeVip.get() != null || routeHost.get() != null) {

        ctx.set("routeHost", routeHost.get());
        ctx.set("routeVIP", routeVip.get());

        request.getHeaders().set(ZuulHeaders.X_ZUUL_SURGICAL_FILTER, "true");

        HttpQueryParams queryParams = request.getQueryParams();
        queryParams.set("debugRequest", "true");

        ctx.setDebugRequest(true);
        ctx.set("zuulToZuul", true);

    }
    return request;
}
 
Example 2
Source File: DynamicPropertiesImpl.java    From servicecomb-java-chassis with Apache License 2.0 4 votes vote down vote up
@Override
public String getStringProperty(String propertyName, Consumer<String> consumer, String defaultValue) {
  DynamicStringProperty prop = propertyFactoryInstance().getStringProperty(propertyName, defaultValue);
  prop.addCallback(() -> consumer.accept(prop.get()));
  return prop.get();
}
 
Example 3
Source File: ServletConfig.java    From servicecomb-java-chassis with Apache License 2.0 4 votes vote down vote up
public static String getLocalServerAddress() {
  DynamicStringProperty address =
      DynamicPropertyFactory.getInstance().getStringProperty(SERVICECOMB_REST_ADDRESS, null);
  return address.get();
}
 
Example 4
Source File: ServletConfig.java    From servicecomb-java-chassis with Apache License 2.0 4 votes vote down vote up
public static String getServletUrlPattern() {
  DynamicStringProperty address =
      DynamicPropertyFactory.getInstance().getStringProperty(KEY_SERVLET_URL_PATTERN, null);
  return address.get();
}
 
Example 5
Source File: TransportConfig.java    From servicecomb-java-chassis with Apache License 2.0 4 votes vote down vote up
public static String getAddress() {
  DynamicStringProperty address =
      DynamicPropertyFactory.getInstance().getStringProperty("servicecomb.rest.address", null);
  return address.get();
}
 
Example 6
Source File: HighwayConfig.java    From servicecomb-java-chassis with Apache License 2.0 4 votes vote down vote up
public static String getAddress() {
  DynamicStringProperty address =
      DynamicPropertyFactory.getInstance().getStringProperty("servicecomb.highway.address", null);
  return address.get();
}
 
Example 7
Source File: ConfigSubscriber.java    From AsuraFramework with Apache License 2.0 4 votes vote down vote up
@Override
public String getString(String key, String defaultValue, Runnable callback) {
    final DynamicStringProperty property = DynamicPropertyFactory.getInstance().getStringProperty(key, defaultValue, callback);
    return property.get();
}
 
Example 8
Source File: ConfigSubscriber.java    From AsuraFramework with Apache License 2.0 2 votes vote down vote up
/**
 * @param key
 *         配置项的key
 * @param defaultValue
 *         如果取回的配置项值为空, 应该返回的默认值
 *
 * @return 配置项的值
 */
@Override
public String getString(String key, String defaultValue) {
    final DynamicStringProperty property = DynamicPropertyFactory.getInstance().getStringProperty(key, defaultValue);
    return property.get();
}