...
|
...
|
@@ -112,14 +112,14 @@ public class HttpRestClientServiceImpl implements HttpRestClientService { |
|
|
|
|
|
|
|
|
@Override
|
|
|
public <T> T getWithHost(String path, Map request, Class<T> responseType) {
|
|
|
public <T> T getWithHeaderHost(String path, Map request, Class<T> responseType) {
|
|
|
|
|
|
logger.debug("begin to do http get host. path:{}, request params:{}", path, request);
|
|
|
|
|
|
//add accept json
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);
|
|
|
headers.set("Host","erp.yoho.yohoops.org");
|
|
|
// headers.set("Accept", MediaType.APPLICATION_JSON_VALUE);
|
|
|
headers.set("Host", "erp.yoho.yohoops.org");
|
|
|
HttpEntity<?> entity = new HttpEntity<>(headers);
|
|
|
|
|
|
//url
|
...
|
...
|
@@ -136,13 +136,14 @@ public class HttpRestClientServiceImpl implements HttpRestClientService { |
|
|
}
|
|
|
|
|
|
final URI getURI = builder.build().encode().toUri();
|
|
|
logger.debug("begin to do http get host. url:{}", getURI);
|
|
|
|
|
|
try {
|
|
|
HttpEntity<T> response = restTemplate.exchange(getURI, HttpMethod.GET, entity, responseType);
|
|
|
logger.debug("end to do http get. path:{}, request params:{}. response body: {}", path, request, response.getBody());
|
|
|
return response.getBody();
|
|
|
} catch (Exception e) {
|
|
|
logger.error("doPostStringJson failed!url:"+path, e);
|
|
|
logger.error("getWithHeaderHost failed!url:"+path, e);
|
|
|
return null;
|
|
|
}
|
|
|
}
|
...
|
...
|
|