feat(会话连接): 支持会话连接支持获取 WEB 会话的URL

This commit is contained in:
lqyan
2024-08-08 19:41:56 +08:00
parent 75c7e02253
commit 3686d17f9d
4 changed files with 15 additions and 12 deletions

View File

@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>jhinno-openapi-java-sdk</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
<packaging>jar</packaging>
<name>Jhinno OpenAPI SDK for Java</name>
<description>The Jhinno OpenAPI SDK for Java used for accessing Jhinno OpenApi Service</description>
@@ -14,7 +14,7 @@
<parent>
<groupId>com.jhinno</groupId>
<artifactId>jhinno-openapi-java-sdk-parent</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
</parent>
<dependencies>

View File

@@ -86,12 +86,14 @@ public class JHAppApiExecution extends JHApiExecution {
if (CollectionUtil.isEmpty(data)) {
throw new ServiceException(path, 500, "获取到的会话信息为空");
}
AppStartedInfo appStartedInfo = data.get(0);
appStartedInfo.setWebSessionUrl(getWebSessionUrl(username, appStartedInfo.getDesktopId()));
return appStartedInfo;
}
String webSessionUrlPath = AppPathConstant.WEB_SESSION_URL_PATH.replace("{desktopId}", appStartedInfo.getDesktopId());
public String getWebSessionUrl(String username, String desktopId) {
String webSessionUrlPath = AppPathConstant.WEB_SESSION_URL_PATH.replace("{desktopId}", desktopId);
String url = getJhApiClient().getUrl(webSessionUrlPath);
Map<String, Object> params = new HashMap<>();
AuthType authType = getAuthType();
if (authType == AuthType.TOKEN_MODE) {
@@ -103,9 +105,7 @@ public class JHAppApiExecution extends JHApiExecution {
params.put(CommonConstant.CURRENT_TIME_MILLIS, currentTimeMillis);
params.put(CommonConstant.SIGNATURE, getsSignature(username, currentTimeMillis));
}
url = JHApiClient.getUrl(url, params);
appStartedInfo.setWebSessionUrl(url);
return appStartedInfo;
return JHApiClient.getUrl(url, params);
}
/**
@@ -298,7 +298,10 @@ public class JHAppApiExecution extends JHApiExecution {
if (CollectionUtil.isEmpty(list)) {
throw new ServiceException(path, 500, "获取到的会话信息为空");
}
return list.get(0);
AppStartedInfo appStartedInfo = list.get(0);
appStartedInfo.setWebSessionUrl(getWebSessionUrl(username, sessionId));
return appStartedInfo;
}

View File

@@ -14,7 +14,7 @@
<parent>
<groupId>com.jhinno</groupId>
<artifactId>jhinno-openapi-java-sdk-parent</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
</parent>
@@ -22,7 +22,7 @@
<dependency>
<groupId>com.jhinno</groupId>
<artifactId>jhinno-openapi-java-sdk</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
</dependency>
<dependency>

View File

@@ -6,7 +6,7 @@
<groupId>com.jhinno</groupId>
<artifactId>jhinno-openapi-java-sdk-parent</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
<packaging>pom</packaging>
<name>Jhinno OpenAPI SDK for Java parent</name>
<description>The Jhinno OpenAPI SDK for Java used for accessing Jhinno OpenApi Service</description>