use of org.apache.servicecomb.service.center.client.model.MicroserviceResponse in project incubator-servicecomb-java-chassis by apache.
the class ServiceCenterClient method getMicroserviceByServiceId.
@Override
public Microservice getMicroserviceByServiceId(String serviceId) {
try {
HttpResponse response = httpClient.getHttpRequest("/registry/microservices/" + serviceId, null, null);
if (response.getStatusCode() == HttpStatus.SC_OK) {
MicroserviceResponse microserviceResponse = HttpUtils.deserialize(response.getContent(), MicroserviceResponse.class);
return microserviceResponse.getService();
}
sendUnAuthorizedEvent(response);
throw new OperationException("get service message fails, statusCode = " + response.getStatusCode() + "; message = " + response.getMessage() + "; content = " + response.getContent());
} catch (IOException e) {
throw new OperationException("get service message fails", e);
}
}
use of org.apache.servicecomb.service.center.client.model.MicroserviceResponse in project java-chassis by ServiceComb.
the class ServiceCenterClient method getMicroserviceByServiceId.
@Override
public Microservice getMicroserviceByServiceId(String serviceId) {
try {
HttpResponse response = httpClient.getHttpRequest("/registry/microservices/" + serviceId, null, null);
if (response.getStatusCode() == HttpStatus.SC_OK) {
MicroserviceResponse microserviceResponse = HttpUtils.deserialize(response.getContent(), MicroserviceResponse.class);
return microserviceResponse.getService();
}
sendUnAuthorizedEvent(response);
throw new OperationException("get service message fails, statusCode = " + response.getStatusCode() + "; message = " + response.getMessage() + "; content = " + response.getContent());
} catch (IOException e) {
throw new OperationException("get service message fails", e);
}
}
Aggregations