Domain domain = habitat.getService(Domain.class);
String forwardInstanceName = extractTargetInstanceName(sourceUriInfo);
Server forwardInstance = domain.getServerNamed(forwardInstanceName);
if (forwardInstance != null) {
UriBuilder forwardUriBuilder = constructForwardURLPath(sourceUriInfo);
URI forwardURI = forwardUriBuilder.scheme("https").host(forwardInstance.getAdminHost()).port(forwardInstance.getAdminPort()).build(); //Host and Port are replaced to that of forwardInstanceName
WebTarget resourceBuilder = client.target(forwardURI);
addAuthenticationInfo(client, resourceBuilder, forwardInstance, habitat);
Response response = resourceBuilder.request(MediaType.APPLICATION_JSON).get(Response.class); //TODO if the target server is down, we get ClientResponseException. Need to handle it
Response.Status status = Response.Status.fromStatusCode(response.getStatus());
if (status.getFamily() == javax.ws.rs.core.Response.Status.Family.SUCCESSFUL) {