修复assist使用https时无法请求的bug
parent
d68aebd409
commit
a9264a8bc0
|
@ -78,11 +78,11 @@ public class AssistRESTfulUtils {
|
||||||
logger.warn("未启用Assist服务");
|
logger.warn("未启用Assist服务");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
StringBuffer stringBuffer = new StringBuffer();
|
StringBuilder stringBuffer = new StringBuilder();
|
||||||
stringBuffer.append(String.format("http://%s:%s/%s", mediaServerItem.getIp(), mediaServerItem.getRecordAssistPort(), api));
|
stringBuffer.append(api);
|
||||||
JSONObject responseJSON = null;
|
JSONObject responseJSON = null;
|
||||||
|
|
||||||
if (param != null && param.keySet().size() > 0) {
|
if (param != null && !param.keySet().isEmpty()) {
|
||||||
stringBuffer.append("?");
|
stringBuffer.append("?");
|
||||||
int index = 1;
|
int index = 1;
|
||||||
for (String key : param.keySet()){
|
for (String key : param.keySet()){
|
||||||
|
@ -97,6 +97,7 @@ public class AssistRESTfulUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
String url = stringBuffer.toString();
|
String url = stringBuffer.toString();
|
||||||
|
logger.info("[访问assist]: {}", url);
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.get()
|
.get()
|
||||||
.url(url)
|
.url(url)
|
||||||
|
@ -262,7 +263,8 @@ public class AssistRESTfulUtils {
|
||||||
return sendPost(mediaServerItem, urlStr, videoTaskInfoJSON, null, 30);
|
return sendPost(mediaServerItem, urlStr, videoTaskInfoJSON, null, 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JSONObject queryTaskList(MediaServerItem mediaServerItem, String app, String stream, String callId, String taskId, Boolean isEnd) {
|
public JSONObject queryTaskList(MediaServerItem mediaServerItem, String app, String stream, String callId,
|
||||||
|
String taskId, Boolean isEnd, String scheme) {
|
||||||
Map<String, Object> param = new HashMap<>();
|
Map<String, Object> param = new HashMap<>();
|
||||||
if (!ObjectUtils.isEmpty(app)) {
|
if (!ObjectUtils.isEmpty(app)) {
|
||||||
param.put("app", app);
|
param.put("app", app);
|
||||||
|
@ -279,7 +281,8 @@ public class AssistRESTfulUtils {
|
||||||
if (!ObjectUtils.isEmpty(isEnd)) {
|
if (!ObjectUtils.isEmpty(isEnd)) {
|
||||||
param.put("isEnd", isEnd);
|
param.put("isEnd", isEnd);
|
||||||
}
|
}
|
||||||
|
String urlStr = String.format("%s://%s:%s/api/record/file/download/task/list",
|
||||||
return sendGet(mediaServerItem, "api/record/file/download/task/list", param, null);
|
scheme, mediaServerItem.getIp(), mediaServerItem.getRecordAssistPort());;
|
||||||
|
return sendGet(mediaServerItem, urlStr, param, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ public interface ICloudRecordService {
|
||||||
/**
|
/**
|
||||||
* 查询合并任务列表
|
* 查询合并任务列表
|
||||||
*/
|
*/
|
||||||
JSONArray queryTask(String app, String stream, String callId, String taskId, String mediaServerId, Boolean isEnd);
|
JSONArray queryTask(String app, String stream, String callId, String taskId, String mediaServerId, Boolean isEnd, String scheme);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 收藏视频,收藏的视频过期不会删除
|
* 收藏视频,收藏的视频过期不会删除
|
||||||
|
|
|
@ -142,7 +142,8 @@ public class CloudRecordServiceImpl implements ICloudRecordService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONArray queryTask(String app, String stream, String callId, String taskId, String mediaServerId, Boolean isEnd) {
|
public JSONArray queryTask(String app, String stream, String callId, String taskId, String mediaServerId,
|
||||||
|
Boolean isEnd, String scheme) {
|
||||||
MediaServerItem mediaServerItem = null;
|
MediaServerItem mediaServerItem = null;
|
||||||
if (mediaServerId == null) {
|
if (mediaServerId == null) {
|
||||||
mediaServerItem = mediaServerService.getDefaultMediaServer();
|
mediaServerItem = mediaServerService.getDefaultMediaServer();
|
||||||
|
@ -152,7 +153,8 @@ public class CloudRecordServiceImpl implements ICloudRecordService {
|
||||||
if (mediaServerItem == null) {
|
if (mediaServerItem == null) {
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到可用的流媒体");
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到可用的流媒体");
|
||||||
}
|
}
|
||||||
JSONObject result = assistRESTfulUtils.queryTaskList(mediaServerItem, app, stream, callId, taskId, isEnd);
|
|
||||||
|
JSONObject result = assistRESTfulUtils.queryTaskList(mediaServerItem, app, stream, callId, taskId, isEnd, scheme);
|
||||||
if (result == null || result.getInteger("code") != 0) {
|
if (result == null || result.getInteger("code") != 0) {
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), result == null ? "查询任务列表失败" : result.getString("msg"));
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), result == null ? "查询任务列表失败" : result.getString("msg"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,7 +174,7 @@ public class CloudRecordController {
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到可用的流媒体");
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到可用的流媒体");
|
||||||
}else {
|
}else {
|
||||||
if (remoteHost == null) {
|
if (remoteHost == null) {
|
||||||
remoteHost = request.getScheme() + "://" + request.getLocalAddr() + ":" + mediaServerItem.getRecordAssistPort();
|
remoteHost = request.getScheme() + "://" + mediaServerItem.getIp() + ":" + mediaServerItem.getRecordAssistPort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cloudRecordService.addTask(app, stream, mediaServerItem, startTime, endTime, callId, remoteHost, mediaServerId != null);
|
return cloudRecordService.addTask(app, stream, mediaServerItem, startTime, endTime, callId, remoteHost, mediaServerId != null);
|
||||||
|
@ -187,6 +187,7 @@ public class CloudRecordController {
|
||||||
@Parameter(name = "mediaServerId", description = "流媒体ID", required = false)
|
@Parameter(name = "mediaServerId", description = "流媒体ID", required = false)
|
||||||
@Parameter(name = "isEnd", description = "是否结束", required = false)
|
@Parameter(name = "isEnd", description = "是否结束", required = false)
|
||||||
public JSONArray queryTaskList(
|
public JSONArray queryTaskList(
|
||||||
|
HttpServletRequest request,
|
||||||
@RequestParam(required = false) String app,
|
@RequestParam(required = false) String app,
|
||||||
@RequestParam(required = false) String stream,
|
@RequestParam(required = false) String stream,
|
||||||
@RequestParam(required = false) String callId,
|
@RequestParam(required = false) String callId,
|
||||||
|
@ -197,7 +198,8 @@ public class CloudRecordController {
|
||||||
if (ObjectUtils.isEmpty(mediaServerId)) {
|
if (ObjectUtils.isEmpty(mediaServerId)) {
|
||||||
mediaServerId = null;
|
mediaServerId = null;
|
||||||
}
|
}
|
||||||
return cloudRecordService.queryTask(app, stream, callId, taskId, mediaServerId, isEnd);
|
|
||||||
|
return cloudRecordService.queryTask(app, stream, callId, taskId, mediaServerId, isEnd, request.getScheme());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
|
|
Loading…
Reference in New Issue