1616
1717package com .webank .wedatasphere .dss .appconn .manager .utils ;
1818
19+ import com .webank .wedatasphere .dss .common .utils .MapUtils ;
20+ import com .webank .wedatasphere .dss .standard .app .sso .builder .SSOUrlBuilderOperation ;
1921import com .webank .wedatasphere .dss .standard .common .desc .AppInstance ;
2022import org .apache .commons .lang .StringUtils ;
2123import org .apache .linkis .common .conf .CommonVars ;
@@ -26,12 +28,29 @@ public class AppInstanceConstants {
2628 static final String INDEX_FILE_PREFIX = "index_" ;
2729 static final String INDEX_FILE_SUFFIX = ".index" ;
2830
31+ static final String REQUEST_URI = "reqUri" ;
32+
2933 public static final CommonVars <TimeType > APP_CONN_REFRESH_INTERVAL = CommonVars .apply ("wds.dss.appconn.refresh.interval" , new TimeType ("5m" ));
3034
31- public static String getHomepageUrl (AppInstance appInstance ,
35+ public static String getHomepageUrl (AppInstance appInstance , SSOUrlBuilderOperation ssoUrlBuilderOperation ,
3236 Long workspaceId , String workspaceName ) {
33- return getHomepageUrl (appInstance .getBaseUrl (), appInstance .getHomepageUri (),
37+ String homepageUrl = getHomepageUrl (appInstance .getBaseUrl (), appInstance .getHomepageUri (),
3438 workspaceId , workspaceName );
39+ if (MapUtils .isEmpty (appInstance .getConfig ()) || ssoUrlBuilderOperation == null ||
40+ !appInstance .getConfig ().containsKey (REQUEST_URI )) {
41+ return homepageUrl ;
42+ } else {
43+ String reqUri = (String ) appInstance .getConfig ().get (REQUEST_URI );
44+ String reqUrl ;
45+ if (appInstance .getBaseUrl ().endsWith ("/" )) {
46+ reqUrl = appInstance .getBaseUrl () + reqUri ;
47+ } else {
48+ reqUrl = appInstance .getBaseUrl () + "/" + reqUri ;
49+ }
50+ ssoUrlBuilderOperation .redirectTo (homepageUrl );
51+ ssoUrlBuilderOperation .setReqUrl (reqUrl );
52+ return ssoUrlBuilderOperation .getBuiltUrl ();
53+ }
3554 }
3655
3756 public static String getHomepageUrl (String baseUrl , String homepageUri ,
0 commit comments