use of com.netflix.discovery.shared.transport.EurekaHttpResponse in project eureka by Netflix.
the class AbstractJersey2EurekaHttpClient method getInstanceInternal.
private EurekaHttpResponse<InstanceInfo> getInstanceInternal(String urlPath) {
Response response = null;
try {
Builder requestBuilder = jerseyClient.target(serviceUrl).path(urlPath).request();
addExtraProperties(requestBuilder);
addExtraHeaders(requestBuilder);
response = requestBuilder.accept(MediaType.APPLICATION_JSON_TYPE).get();
InstanceInfo infoFromPeer = null;
if (response.getStatus() == Status.OK.getStatusCode() && response.hasEntity()) {
infoFromPeer = response.readEntity(InstanceInfo.class);
}
return anEurekaHttpResponse(response.getStatus(), infoFromPeer).headers(headersOf(response)).build();
} finally {
if (logger.isDebugEnabled()) {
logger.debug("Jersey2 HTTP GET {}/{}; statusCode={}", serviceUrl, urlPath, response == null ? "N/A" : response.getStatus());
}
if (response != null) {
response.close();
}
}
}
Aggregations