Java Code Examples for com.netflix.client.config.IClientConfig#set()

The following examples show how to use com.netflix.client.config.IClientConfig#set() . 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: ClientPropertiesProcessor.java    From ribbon with Apache License 2.0 6 votes vote down vote up
@Override
public void process(String groupName, GroupBuilder groupBuilder, RibbonResourceFactory resourceFactory, Class<?> interfaceClass) {
    ClientProperties properties = interfaceClass.getAnnotation(ClientProperties.class);
    if (properties != null) {
        IClientConfig config = resourceFactory.getClientConfigFactory().newConfig();
        for (Property prop : properties.properties()) {
            String name = prop.name();
            config.set(CommonClientConfigKey.valueOf(name), prop.value());
        }
        ClientOptions options = ClientOptions.from(config);
        groupBuilder.withClientOptions(options);
        if (properties.exportToArchaius()) {
            exportPropertiesToArchaius(groupName, config, interfaceClass.getName());
        }
    }
}
 
Example 2
Source File: FollowRedirectTest.java    From ribbon with Apache License 2.0 5 votes vote down vote up
@Test
public void testRedirectNotFollowed() throws Exception {
    IClientConfig config = DefaultClientConfigImpl.getClientConfigWithDefaultValues("myclient");
    config.set(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());          
}
 
Example 3
Source File: BasicNettyOrigin.java    From zuul with Apache License 2.0 5 votes vote down vote up
protected IClientConfig setupClientConfig(String name) {
    // Get the NIWS properties for this Origin.
    IClientConfig niwsClientConfig = DefaultClientConfigImpl.getClientConfigWithDefaultValues(name);
    niwsClientConfig.set(CommonClientConfigKey.ClientClassName, name);
    niwsClientConfig.loadProperties(name);
    return niwsClientConfig;
}
 
Example 4
Source File: DiscoveryEnabledNIWSServerList.java    From ribbon with Apache License 2.0 4 votes vote down vote up
private static IClientConfig createClientConfig(String vipAddresses) {
    IClientConfig clientConfig = ClientConfigFactory.DEFAULT.newConfig();
    clientConfig.set(Keys.DeploymentContextBasedVipAddresses, vipAddresses);
    return clientConfig;
}
 
Example 5
Source File: RxMovieTransportExample.java    From ribbon with Apache License 2.0 4 votes vote down vote up
public RxMovieTransportExample(int port) {
    IClientConfig clientConfig = IClientConfig.Builder.newBuilder("movieServiceClient").build();
    clientConfig.set(CommonClientConfigKey.ListOfServers, "localhost:" + port);
    client = RibbonTransport.newHttpClient(clientConfig);
}
 
Example 6
Source File: ProxyEndpoint.java    From zuul with Apache License 2.0 4 votes vote down vote up
private Integer setReadTimeoutOnContext(IClientConfig requestConfig, int attempt)
{
    Integer readTimeout = getReadTimeout(requestConfig, attempt);
    requestConfig.set(ReadTimeout, readTimeout);
    return readTimeout;
}