Ver código fonte

获取地址类修改

gao.qiang 1 ano atrás
pai
commit
322d6a1c30

+ 2 - 0
base-common/src/main/java/com/ozs/common/utils/http/HttpUtils.java

@@ -76,6 +76,8 @@ public class HttpUtils
             connection.setRequestProperty("connection", "Keep-Alive");
             connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
             connection.connect();
+            log.info("connection.getInputStream() - {}", connection.getInputStream());
+            log.info("contentType - {}", contentType);
             in = new BufferedReader(new InputStreamReader(connection.getInputStream(), contentType));
             String line;
             while ((line = in.readLine()) != null)

+ 1 - 1
base-common/src/main/java/com/ozs/common/utils/ip/AddressUtils.java

@@ -35,7 +35,7 @@ public class AddressUtils
         {
             try
             {
-                String rspStr = HttpUtils.sendGet(IP_URL, "ip=" + ip + "&json=true", Constants.GBK);
+                String rspStr = HttpUtils.sendGet(IP_URL, "ip=" + ip + "&json=true", Constants.UTF8);
                 if (StringUtils.isEmpty(rspStr))
                 {
                     log.error("获取地理位置异常 {}", ip);