diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/RestClientRibbonCommand.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/RestClientRibbonCommand.java index 5959a5fa..8cb95861 100644 --- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/RestClientRibbonCommand.java +++ b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/RestClientRibbonCommand.java @@ -55,7 +55,7 @@ public class RestClientRibbonCommand extends HystrixCommand private Verb verb; private URI uri; - + private Boolean retryable; private MultiValueMap headers; @@ -97,7 +97,7 @@ public class RestClientRibbonCommand extends HystrixCommand .withExecutionIsolationStrategy(ExecutionIsolationStrategy.SEMAPHORE) .withExecutionIsolationSemaphoreMaxConcurrentRequests(value.get()); return Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("RibbonCommand")) - .andCommandKey(HystrixCommandKey.Factory.asKey(commandKey + "RibbonCommand")) + .andCommandKey(HystrixCommandKey.Factory.asKey(commandKey)) .andCommandPropertiesDefaults(setter); } @@ -110,11 +110,11 @@ public class RestClientRibbonCommand extends HystrixCommand RequestContext context = RequestContext.getCurrentContext(); Builder builder = HttpRequest.newBuilder().verb(this.verb).uri(this.uri) .entity(this.requestEntity); - - if(retryable != null) { - builder.setRetriable(retryable); + + if(this.retryable != null) { + builder.setRetriable(this.retryable); } - + for (String name : this.headers.keySet()) { List values = this.headers.get(name); for (String value : values) { @@ -134,11 +134,11 @@ public class RestClientRibbonCommand extends HystrixCommand HttpResponse response = this.restClient .executeWithLoadBalancer(httpClientRequest); context.set("ribbonResponse", response); - + // Explicitly close the HttpResponse if the Hystrix command timed out to // release the underlying HTTP connection held by the response. - // - if( this.isResponseTimedOut() ) { + // + if( this.isResponseTimedOut() ) { if( response!= null ) { response.close(); } @@ -154,30 +154,30 @@ public class RestClientRibbonCommand extends HystrixCommand } protected MultiValueMap getHeaders() { - return headers; + return this.headers; } protected MultiValueMap getParams() { - return params; + return this.params; } protected InputStream getRequestEntity() { - return requestEntity; + return this.requestEntity; } protected RestClient getRestClient() { - return restClient; + return this.restClient; } protected Boolean getRetryable() { - return retryable; + return this.retryable; } protected URI getUri() { - return uri; + return this.uri; } protected Verb getVerb() { - return verb; + return this.verb; } } diff --git a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/RestClientRibbonCommandFactory.java b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/RestClientRibbonCommandFactory.java index da011c68..30cd9dbf 100644 --- a/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/RestClientRibbonCommandFactory.java +++ b/spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/zuul/filters/route/RestClientRibbonCommandFactory.java @@ -16,10 +16,12 @@ package org.springframework.cloud.netflix.zuul.filters.route; +import org.springframework.cloud.netflix.ribbon.SpringClientFactory; + import com.netflix.client.http.HttpRequest; import com.netflix.niws.client.http.RestClient; + import lombok.SneakyThrows; -import org.springframework.cloud.netflix.ribbon.SpringClientFactory; /** * @author Spencer Gibb @@ -45,7 +47,7 @@ public class RestClientRibbonCommandFactory implements RibbonCommandFactory