use of com.netflix.zuul.context.NFRequestContext in project zuul by Netflix.
the class RibbonCommand method forward.
HttpResponse forward() throws Exception {
NFRequestContext context = NFRequestContext.getCurrentContext();
HttpRequest.Builder builder = HttpRequest.newBuilder().verb(verb).uri(uri).entity(requestEntity);
for (String name : headers.keySet()) {
List<String> values = headers.get(name);
for (String value : values) {
builder.header(name, value);
}
}
for (String name : params.keySet()) {
List<String> values = params.get(name);
for (String value : values) {
builder.queryParams(name, value);
}
}
HttpRequest httpClientRequest = builder.build();
HttpResponse response = restClient.executeWithLoadBalancer(httpClientRequest);
context.setZuulResponse(response);
// chain has already continued without us and therefore won't cleanup itself.
if (isResponseTimedOut()) {
response.close();
}
return response;
}
Aggregations