use of com.netflix.client.config.IClientConfig in project ribbon by Netflix.
the class RibbonTransportFactory method newUdpClient.
public RxClient<DatagramPacket, DatagramPacket> newUdpClient(String name) {
IClientConfig config = clientConfigFactory.newConfig();
config.loadProperties(name);
return newUdpClient(config);
}
use of com.netflix.client.config.IClientConfig in project ribbon by Netflix.
the class RibbonTransportFactory method newHttpClient.
public final HttpClient<ByteBuf, ByteBuf> newHttpClient(String name) {
IClientConfig config = clientConfigFactory.newConfig();
config.loadProperties(name);
return newHttpClient(config);
}
use of com.netflix.client.config.IClientConfig in project ribbon by Netflix.
the class AbstractLoadBalancerAwareClient method isRetriable.
@Deprecated
protected boolean isRetriable(S request) {
if (request.isRetriable()) {
return true;
} else {
boolean retryOkayOnOperation = okToRetryOnAllOperations;
IClientConfig overriddenClientConfig = request.getOverrideConfig();
if (overriddenClientConfig != null) {
retryOkayOnOperation = overriddenClientConfig.getPropertyAsBoolean(CommonClientConfigKey.RequestSpecificRetryOn, okToRetryOnAllOperations);
}
return retryOkayOnOperation;
}
}
use of com.netflix.client.config.IClientConfig in project ribbon by Netflix.
the class ClientFactory method getNamedConfig.
/**
* Get the client configuration given the name or create one with clientConfigClass if it does not exist. An instance of IClientConfig
* is created and {@link IClientConfig#loadProperties(String)} will be called.
*/
public static IClientConfig getNamedConfig(String name, Class<? extends IClientConfig> clientConfigClass) {
IClientConfig config = namedConfig.get(name);
if (config != null) {
return config;
} else {
try {
config = (IClientConfig) clientConfigClass.newInstance();
config.loadProperties(name);
} catch (InstantiationException | IllegalAccessException e) {
logger.error("Unable to create named client config '{}' instance for config class {}", name, clientConfigClass, e);
return null;
}
config.loadProperties(name);
IClientConfig old = namedConfig.putIfAbsent(name, config);
if (old != null) {
config = old;
}
return config;
}
}
use of com.netflix.client.config.IClientConfig in project ribbon by Netflix.
the class FollowRedirectTest method testRedirectNotFollowed.
@Test
public void testRedirectNotFollowed() throws Exception {
IClientConfig config = DefaultClientConfigImpl.getClientConfigWithDefaultValues("myclient");
config.setProperty(CommonClientConfigKey.FollowRedirects, Boolean.FALSE);
ClientFactory.registerClientFromProperties("myclient", config);
RestClient client = (RestClient) ClientFactory.getNamedClient("myclient");
HttpRequest request = HttpRequest.newBuilder().uri(new URI("http://localhost:" + redirectingServer.getPort())).build();
HttpResponse response = client.executeWithLoadBalancer(request);
assertEquals(302, response.getStatus());
}
Aggregations