Skip to content

Commit 23f58f0

Browse files
committed
Delete unnecessary configuration.
1 parent 02c920b commit 23f58f0

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

conf/linkis.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# 1. need configuration
33
# 需要配置
44
# ##################################
5-
wds.linkis.gateway.url=http://127.0.0.1:9001/
5+
wds.linkis.gateway.url=http://127.0.0.1:9001
66

77
# 需配置和Linkis结果集路径保持一致
88
wds.linkis.filesystem.root.path=file:///mnt/bdap/

server/src/main/java/com/webank/wedatasphere/dss/visualis/utils/HttpUtils.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import javax.servlet.http.Cookie;
1818
import javax.servlet.http.HttpServletRequest;
1919
import java.io.IOException;
20+
import java.net.URI;
2021
import java.net.URISyntaxException;
2122
import java.util.Date;
2223

@@ -34,7 +35,7 @@ public static String getDbs(String ticketId) {
3435
HttpGet httpGet = new HttpGet(DATABASE_URL);
3536
BasicClientCookie cookie = new BasicClientCookie(CommonConfig.TICKET_ID_STRING().getValue(), ticketId);
3637
cookie.setVersion(0);
37-
cookie.setDomain(CommonConfig.GATEWAY_IP().getValue());
38+
cookie.setDomain(getIpFromUrl(GATEWAY_URL));
3839
cookie.setPath("/");
3940
cookie.setExpiryDate(new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 24 * 30L));
4041
cookieStore.addCookie(cookie);
@@ -59,7 +60,7 @@ public static String getTables(String ticketId, String hiveDBName) {
5960
HttpGet httpGet = new HttpGet(uriBuilder.build());
6061
BasicClientCookie cookie = new BasicClientCookie(CommonConfig.TICKET_ID_STRING().getValue(), ticketId);
6162
cookie.setVersion(0);
62-
cookie.setDomain(CommonConfig.GATEWAY_IP().getValue());
63+
cookie.setDomain(getIpFromUrl(GATEWAY_URL));
6364
cookie.setPath("/");
6465
cookieStore.addCookie(cookie);
6566
CloseableHttpResponse response = httpClient.execute(httpGet);
@@ -84,7 +85,7 @@ public static String getColumns(String dbName, String tableName, String ticketId
8485
HttpGet httpGet = new HttpGet(uriBuilder.build());
8586
BasicClientCookie cookie = new BasicClientCookie(CommonConfig.TICKET_ID_STRING().getValue(), ticketId);
8687
cookie.setVersion(0);
87-
cookie.setDomain(CommonConfig.GATEWAY_IP().getValue());
88+
cookie.setDomain(getIpFromUrl(GATEWAY_URL));
8889
cookie.setPath("/");
8990
cookieStore.addCookie(cookie);
9091
CloseableHttpResponse response = httpClient.execute(httpGet);
@@ -109,6 +110,18 @@ public static String getUserTicketId(HttpServletRequest request) {
109110
return ticketId;
110111
}
111112

113+
// http://127.0.0.1:9001
114+
private static String getIpFromUrl(String url) {
115+
URI uri = URI.create(url);
116+
String ip = "";
117+
int port = 0;
118+
if (null != null) {
119+
ip = uri.getHost();
120+
port = uri.getPort();
121+
}
122+
return ip;
123+
}
124+
112125
}
113126

114127

0 commit comments

Comments
 (0)