public ChainedDynamicProperty.StringProperty getChainedStringProperty(String overrideKey, String primaryKey,String defaultValue, Runnable listener) { final String mapKey = overrideKey + primaryKey; ChainedDynamicProperty.StringProperty prop = (ChainedDynamicProperty.StringProperty) fastPropMap.get(mapKey); if (prop != null) return prop; final DynamicStringProperty baseProp = new DynamicStringProperty(primaryKey,defaultValue); prop = new ChainedDynamicProperty.StringProperty(overrideKey, baseProp); fastPropMap.put(mapKey, prop); if(listener != null) { baseProp.addCallback(listener); prop.addCallback(listener); } return prop; }
@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; } }
@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; } }
/** * Create a new property whose value is a string and subject to change on-the-fly. * * @param propName property name * @param defaultValue default value if the property is not defined in underlying configuration * @param propertyChangeCallback a Runnable to be called when the property is changed */ public DynamicStringProperty getStringProperty(String propName, String defaultValue, final Runnable propertyChangeCallback) { checkAndWarn(propName); DynamicStringProperty property = new DynamicStringProperty(propName, defaultValue); addCallback(propertyChangeCallback, property); return property; }
/** * Create a new property whose value is a string and subject to change on-the-fly. * * @param propName property name * @param defaultValue default value if the property is not defined in underlying configuration * @param propertyChangeCallback a Runnable to be called when the property is changed */ public DynamicStringProperty getStringProperty(String propName, String defaultValue, final Runnable propertyChangeCallback) { checkAndWarn(propName); DynamicStringProperty property = new DynamicStringProperty(propName, defaultValue); addCallback(propertyChangeCallback, property); return property; }
@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; } }