Skip to content

Commit 6a8371d

Browse files
committed
fix bug
1 parent 7fc3b83 commit 6a8371d

File tree

9 files changed

+51
-66
lines changed

9 files changed

+51
-66
lines changed

assembly/bin/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ SERVER_IP=""
1313
SERVER_HOME=""
1414

1515
local_host="`hostname --fqdn`"
16-
LOCAL_IP="`ifconfig | grep 'inet' | grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $2}'`"
16+
LOCAL_IP=$(hostname -I)
1717

1818
#To be compatible with MacOS and Linux
1919
txt=""

dss-apps/dss-apiservice-server/src/main/java/com/webank/wedatasphere/dss/apiservice/core/restful/ApiServiceCoreRestfulApi.java

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,33 @@
1717
package com.webank.wedatasphere.dss.apiservice.core.restful;
1818

1919
import com.webank.wedatasphere.dss.apiservice.core.bo.ApiServiceQuery;
20+
import com.webank.wedatasphere.dss.apiservice.core.service.ApiService;
21+
import com.webank.wedatasphere.dss.apiservice.core.service.ApiServiceQueryService;
2022
import com.webank.wedatasphere.dss.apiservice.core.util.ApiUtils;
2123
import com.webank.wedatasphere.dss.apiservice.core.util.AssertUtil;
22-
import com.webank.wedatasphere.dss.apiservice.core.vo.*;
23-
import com.webank.wedatasphere.dss.apiservice.core.service.ApiServiceQueryService;
24-
import com.webank.wedatasphere.dss.apiservice.core.service.ApiService;
25-
import org.apache.linkis.server.Message;
26-
import org.apache.linkis.server.security.SecurityFilter;
24+
import com.webank.wedatasphere.dss.apiservice.core.vo.ApiServiceVo;
25+
import com.webank.wedatasphere.dss.apiservice.core.vo.ApiVersionVo;
26+
import com.webank.wedatasphere.dss.apiservice.core.vo.ApprovalVo;
27+
import com.webank.wedatasphere.dss.apiservice.core.vo.QueryParamVo;
2728
import org.apache.commons.collections.MapUtils;
2829
import org.apache.commons.lang.StringUtils;
29-
import org.codehaus.jackson.JsonNode;
30+
import org.apache.linkis.server.Message;
31+
import org.apache.linkis.server.security.SecurityFilter;
3032
import org.slf4j.Logger;
3133
import org.slf4j.LoggerFactory;
3234
import org.springframework.beans.factory.annotation.Autowired;
33-
import org.springframework.stereotype.Component;
3435
import org.springframework.web.bind.annotation.*;
3536

3637
import javax.servlet.http.HttpServletRequest;
3738
import javax.validation.ConstraintViolation;
3839
import javax.validation.ConstraintViolationException;
3940
import javax.validation.Validator;
4041
import javax.validation.groups.Default;
41-
import javax.ws.rs.*;
4242
import javax.ws.rs.core.Context;
43-
import javax.ws.rs.core.MediaType;
44-
import javax.ws.rs.core.Response;
45-
import java.util.*;
43+
import java.util.Calendar;
44+
import java.util.List;
45+
import java.util.Map;
46+
import java.util.Set;
4647
import java.util.regex.Pattern;
4748
import java.util.stream.Collectors;
4849

@@ -453,10 +454,10 @@ public Message apiDelete(@RequestParam(required = false, name = "id") Long id,
453454
}
454455

455456
@RequestMapping(value = "/apiCommentUpdate",method = RequestMethod.POST)
456-
public Message apiCommentUpdate(@Context HttpServletRequest req, JsonNode json) {
457+
public Message apiCommentUpdate(@Context HttpServletRequest req,
458+
@RequestParam(required = false, name = "id") Long id,
459+
@RequestParam(required = false, name = "comment") String comment) {
457460
//目前暂时不实际删除数据,只做不可见和不可用。
458-
Long id = json.get("id").getLongValue();
459-
String comment=json.get("comment").getTextValue();
460461
return ApiUtils.doAndResponse(() -> {
461462
String userName = SecurityFilter.getLoginUsername(req);
462463
if (null == id) {

dss-apps/dss-apiservice-server/src/main/java/com/webank/wedatasphere/dss/apiservice/core/restful/ApiServiceTokenRestfulApi.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,27 @@
1717
package com.webank.wedatasphere.dss.apiservice.core.restful;
1818

1919
import com.github.pagehelper.PageInfo;
20-
import com.webank.wedatasphere.dss.apiservice.core.constant.SaveTokenEnum;
21-
import com.webank.wedatasphere.dss.apiservice.core.token.TokenAuth;
20+
import com.webank.wedatasphere.dss.apiservice.core.bo.TokenQuery;
2221
import com.webank.wedatasphere.dss.apiservice.core.service.TokenQueryService;
22+
import com.webank.wedatasphere.dss.apiservice.core.token.TokenAuth;
2323
import com.webank.wedatasphere.dss.apiservice.core.util.ApiUtils;
2424
import com.webank.wedatasphere.dss.apiservice.core.util.DateUtil;
25-
import com.webank.wedatasphere.dss.apiservice.core.vo.ApprovalVo;
2625
import com.webank.wedatasphere.dss.apiservice.core.vo.TokenManagerVo;
27-
import com.webank.wedatasphere.dss.apiservice.core.bo.TokenQuery;
26+
import org.apache.commons.lang.StringUtils;
2827
import org.apache.linkis.server.Message;
2928
import org.apache.linkis.server.security.SecurityFilter;
30-
import org.apache.commons.lang.StringUtils;
3129
import org.slf4j.Logger;
3230
import org.slf4j.LoggerFactory;
3331
import org.springframework.beans.factory.annotation.Autowired;
34-
import org.springframework.stereotype.Component;
3532
import org.springframework.web.bind.annotation.RequestMapping;
3633
import org.springframework.web.bind.annotation.RequestMethod;
3734
import org.springframework.web.bind.annotation.RequestParam;
3835
import org.springframework.web.bind.annotation.RestController;
3936

4037
import javax.servlet.http.HttpServletRequest;
41-
import javax.ws.rs.*;
4238
import javax.ws.rs.core.Context;
43-
import javax.ws.rs.core.MediaType;
44-
import javax.ws.rs.core.Response;
4539
import java.util.Calendar;
4640
import java.util.Date;
47-
import java.util.List;
4841

4942

5043

dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/restful/DSSDictionaryRestful.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
import com.webank.wedatasphere.dss.framework.workspace.bean.DSSDictionary;
2020
import com.webank.wedatasphere.dss.framework.workspace.bean.vo.DSSDictionaryRequestVO;
2121
import com.webank.wedatasphere.dss.framework.workspace.service.DSSDictionaryService;
22-
import org.apache.linkis.server.Message;
2322
import org.apache.commons.collections.CollectionUtils;
2423
import org.apache.commons.lang.StringUtils;
24+
import org.apache.linkis.server.Message;
2525
import org.slf4j.Logger;
2626
import org.slf4j.LoggerFactory;
2727
import org.springframework.beans.factory.annotation.Autowired;

dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/restful/DSSWorkspacePrivRestful.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import org.apache.commons.math3.util.Pair;
2828
import org.apache.linkis.server.Message;
2929
import org.apache.linkis.server.security.SecurityFilter;
30-
import org.codehaus.jackson.JsonNode;
3130
import org.springframework.beans.factory.annotation.Autowired;
3231
import org.springframework.web.bind.annotation.*;
3332

dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/restful/DSSWorkspaceRestful.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
package com.webank.wedatasphere.dss.framework.workspace.restful;
18+
1819
import com.webank.wedatasphere.dss.framework.workspace.bean.DSSWorkspace;
1920
import com.webank.wedatasphere.dss.framework.workspace.bean.request.CreateWorkspaceRequest;
2021
import com.webank.wedatasphere.dss.framework.workspace.bean.vo.DSSWorkspaceHomePageVO;
@@ -27,18 +28,14 @@
2728
import org.apache.linkis.common.exception.ErrorException;
2829
import org.apache.linkis.server.Message;
2930
import org.apache.linkis.server.security.SecurityFilter;
30-
import org.codehaus.jackson.JsonNode;
3131
import org.springframework.beans.factory.annotation.Autowired;
32-
import org.springframework.stereotype.Component;
3332
import org.springframework.web.bind.annotation.*;
3433

3534
import javax.servlet.http.HttpServletRequest;
36-
import javax.ws.rs.*;
3735
import javax.ws.rs.core.Context;
38-
import javax.ws.rs.core.MediaType;
39-
import javax.ws.rs.core.Response;
4036
import java.util.ArrayList;
4137
import java.util.List;
38+
4239
import static com.webank.wedatasphere.dss.framework.workspace.util.DSSWorkspaceConstant.WORKSPACE_ID_STR;
4340

4441
@RequestMapping(path = "/dss/framework/workspace", produces = {"application/json"})

dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/restful/DSSWorkspaceRoleRestful.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import org.apache.commons.lang.StringUtils;
3131
import org.apache.linkis.server.Message;
3232
import org.apache.linkis.server.security.SecurityFilter;
33-
import org.codehaus.jackson.JsonNode;
3433
import org.slf4j.Logger;
3534
import org.slf4j.LoggerFactory;
3635
import org.springframework.beans.factory.annotation.Autowired;
@@ -39,9 +38,7 @@
3938
import javax.servlet.http.Cookie;
4039
import javax.servlet.http.HttpServletRequest;
4140
import javax.servlet.http.HttpServletResponse;
42-
import javax.ws.rs.QueryParam;
4341
import javax.ws.rs.core.Context;
44-
import java.util.ArrayList;
4542
import java.util.Collections;
4643
import java.util.HashMap;
4744
import java.util.List;

dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/restful/WorkspaceRestfulApi.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,12 @@
2626
import org.apache.linkis.common.exception.ErrorException;
2727
import org.apache.linkis.server.Message;
2828
import org.apache.linkis.server.security.SecurityFilter;
29-
import org.codehaus.jackson.JsonNode;
3029
import org.slf4j.Logger;
3130
import org.slf4j.LoggerFactory;
3231
import org.springframework.beans.factory.annotation.Autowired;
3332
import org.springframework.web.bind.annotation.*;
3433

3534
import javax.servlet.http.HttpServletRequest;
36-
import javax.ws.rs.QueryParam;
3735
import javax.ws.rs.core.Context;
3836
import java.util.HashSet;
3937
import java.util.List;
@@ -73,18 +71,18 @@ public Message getUsernameExistence(@Context HttpServletRequest req, @RequestPar
7371
}
7472

7573
@RequestMapping(path ="/workspaces", method = RequestMethod.POST)
76-
public Message addWorkspace(@Context HttpServletRequest req, JsonNode json) throws ErrorException {
74+
public Message addWorkspace(@Context HttpServletRequest req,
75+
@RequestParam(required = false, name = "name")String name ,
76+
@RequestParam(required = false, name = "department") String department,
77+
@RequestParam(required = false, name = "label") String label,
78+
@RequestParam(required = false, name = "description") String description) throws ErrorException {
7779
String userName = SecurityFilter.getLoginUsername(req);
7880
if (!dssWorkspaceService.checkAdmin(userName)){
7981
return Message.error("您好,您不是管理员,没有权限建立工作空间");
8082
}
81-
String name = json.get("name").getTextValue();
8283
if (dssWorkspaceService.existWorkspaceName(name)) {
8384
return Message.error("工作空间名重复");
8485
}
85-
String department = json.get("department").getTextValue();
86-
String label = json.get("label").getTextValue();
87-
String description = json.get("description").getTextValue();
8886
String productName = "DSS";
8987
int workspaceId = dssWorkspaceService.createWorkspace(name, label, userName, description, department, productName);
9088
return Message.ok().data("workspaceId", workspaceId);
@@ -138,13 +136,12 @@ public Message getWorkspaceFavorites(@Context HttpServletRequest req, @PathVaria
138136
* 应用加入收藏,返回收藏后id
139137
*
140138
* @param req
141-
* @param json
142139
* @return
143140
*/
144141
@RequestMapping(path ="/workspaces/{workspaceId}/favorites", method = RequestMethod.POST)
145-
public Message addFavorite(@Context HttpServletRequest req, @PathVariable("workspaceId") Long workspaceId, JsonNode json) {
142+
public Message addFavorite(@Context HttpServletRequest req, @PathVariable("workspaceId") Long workspaceId,
143+
@RequestParam(required = false, name = "menuApplicationId") Long menuApplicationId) {
146144
String username = SecurityFilter.getLoginUsername(req);
147-
Long menuApplicationId = json.get("menuApplicationId").getLongValue();
148145
Long favoriteId = dssWorkspaceService.addFavorite(username, workspaceId, menuApplicationId);
149146
return Message.ok().data("favoriteId", favoriteId);
150147
}

dss-standard/sso-standard/origin-sso-integration-standard/src/main/scala/com/webank/wedatasphere/dss/standard/app/sso/origin/request/OriginSSORequestOperation.scala

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,32 @@
1616

1717
package com.webank.wedatasphere.dss.standard.app.sso.origin.request
1818

19-
import java.net.{URI, URL, URLDecoder}
20-
import java.util
21-
import java.util.Date
22-
import java.util.concurrent.{ConcurrentHashMap, TimeUnit}
23-
2419
import com.webank.wedatasphere.dss.standard.app.sso.builder.SSOUrlBuilderOperation
2520
import com.webank.wedatasphere.dss.standard.app.sso.builder.impl.SSOUrlBuilderOperationImpl
2621
import com.webank.wedatasphere.dss.standard.app.sso.origin.client.HttpClient
2722
import com.webank.wedatasphere.dss.standard.app.sso.request.SSORequestOperation
2823
import com.webank.wedatasphere.dss.standard.common.exception.AppStandardErrorException
24+
import org.apache.commons.io.IOUtils
25+
import org.apache.http.impl.cookie.BasicClientCookie
2926
import org.apache.linkis.common.utils.{ByteTimeUtils, Logging, Utils}
3027
import org.apache.linkis.httpclient.Client
3128
import org.apache.linkis.httpclient.request.HttpAction
3229
import org.apache.linkis.httpclient.response.impl.DefaultHttpResult
3330
import org.apache.linkis.httpclient.response.{HttpResult, Result}
34-
import org.apache.commons.io.IOUtils
35-
import org.apache.commons.lang.StringUtils
36-
import org.apache.http.impl.cookie.BasicClientCookie
3731

32+
import java.net.URI
33+
import java.util
34+
import java.util.Date
35+
import java.util.concurrent.{ConcurrentHashMap, TimeUnit}
3836
import scala.collection.convert.wrapAsScala._
3937

4038

4139
class OriginSSORequestOperation private[request](appName: String) extends SSORequestOperation[HttpAction, HttpResult] with Logging {
4240

4341
override def requestWithSSO(urlBuilder: SSOUrlBuilderOperation, req: HttpAction): HttpResult = {
4442

45-
val httpClient = HttpClient.getHttpClient(urlBuilder.getBuiltUrl, appName)
43+
// val httpClient = HttpClient.getHttpClient(urlBuilder.getBuiltUrl, appName)
44+
val httpClient =OriginSSORequestOperation.getHttpClient(urlBuilder, appName)
4645
urlBuilder match {
4746
case urlBuilderOperationImpl: SSOUrlBuilderOperationImpl => val cookies = urlBuilderOperationImpl.getCookies
4847
cookies.foreach {
@@ -56,16 +55,16 @@ class OriginSSORequestOperation private[request](appName: String) extends SSOReq
5655
req.addCookie(basicClientCookie)
5756
}
5857
}
59-
Utils.tryFinally({
60-
httpClient.execute(req) match {
61-
case result: HttpResult => result
62-
case result => if (Result.isSuccessResult(result)) {
63-
val defaultHttpResult = new DefaultHttpResult
64-
defaultHttpResult.set(null, 200, null, null)
65-
defaultHttpResult
66-
} else throw new AppStandardErrorException(20300, s"Not support Result => ${result.getClass.getName}.")
67-
}
68-
})(IOUtils.closeQuietly(httpClient))
58+
59+
httpClient.execute(req) match {
60+
case result: HttpResult => result
61+
case result => if (Result.isSuccessResult(result)) {
62+
val defaultHttpResult = new DefaultHttpResult
63+
defaultHttpResult.set(null, 200, null, null)
64+
defaultHttpResult
65+
} else throw new AppStandardErrorException(20300, s"Not support Result => ${result.getClass.getName}.")
66+
}
67+
6968
}
7069

7170
}
@@ -94,7 +93,9 @@ object OriginSSORequestOperation extends Logging {
9493
def getHttpClient(urlBuilder: SSOUrlBuilderOperation, appName: String): Client = urlBuilder match {
9594
case builder: SSOUrlBuilderOperationImpl =>
9695
builder.getCookies.find(_._1 == "bdp-user-ticket-id").foreach { case (_, ticketId) =>
97-
val key = getKey(ticketId, appName)
96+
val baseUrl = HttpClient.getBaseUrl(builder.getBuiltUrl)
97+
val key = getKey(ticketId, appName,baseUrl)
98+
info("Get http client key is "+key)
9899
if (httpClientMap.containsKey(key) && System.currentTimeMillis - httpClientLastAccessMap.get(key) < MAX_ACTIVE_TIME) {
99100
httpClientLastAccessMap.put(key, System.currentTimeMillis)
100101
return httpClientMap.get(key)
@@ -122,6 +123,6 @@ object OriginSSORequestOperation extends Logging {
122123
}
123124

124125

125-
private def getKey(ticketId: String, appName: String): String = appName + ticketId
126+
private def getKey(ticketId: String, appName: String,baseUrl: String ): String = appName + ticketId+baseUrl
126127

127128
}

0 commit comments

Comments
 (0)