1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

Optimize Sentinel RestTemplate url resource

This commit is contained in:
fangjian0423
2018-12-18 17:35:45 +08:00
parent feeacc0a15
commit d204a54b76
5 changed files with 13 additions and 7 deletions

View File

@@ -58,8 +58,8 @@ public class SentinelProtectInterceptor implements ClientHttpRequestInterceptor
public ClientHttpResponse intercept(HttpRequest request, byte[] body,
ClientHttpRequestExecution execution) throws IOException {
URI uri = request.getURI();
String hostResource = uri.getScheme() + "://" + uri.getHost() + ":"
+ (uri.getPort() == -1 ? 80 : uri.getPort());
String hostResource = uri.getScheme() + "://" + uri.getHost()
+ (uri.getPort() == -1 ? "" : ":" + uri.getPort());
String hostWithPathResource = hostResource + uri.getPath();
Entry hostEntry = null, hostWithPathEntry = null;
ClientHttpResponse response;