Commit 0802677d0b609abc8de0f0d882c6dbf483fc1987
Merge remote-tracking branch 'origin/wvp-28181-2.0' into wvp-28181-2.0
Showing
9 changed files
with
72 additions
and
71 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/auth/DigestServerAuthenticationHelper.java
| ... | ... | @@ -239,58 +239,58 @@ public class DigestServerAuthenticationHelper { |
| 239 | 239 | |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - public static void main(String[] args) throws NoSuchAlgorithmException { | |
| 243 | - String realm = "3402000000"; | |
| 244 | - String username = "44010000001180008012"; | |
| 245 | - | |
| 246 | - | |
| 247 | - String nonce = "07cab60999fbf643264ace27d3b7de8b"; | |
| 248 | - String uri = "sip:34020000002000000001@3402000000"; | |
| 249 | - // qop 保护质量 包含auth(默认的)和auth-int(增加了报文完整性检测)两种策略 | |
| 250 | - String qop = "auth"; | |
| 251 | - | |
| 252 | - // 客户端随机数,这是一个不透明的字符串值,由客户端提供,并且客户端和服务器都会使用,以避免用明文文本。 | |
| 253 | - // 这使得双方都可以查验对方的身份,并对消息的完整性提供一些保护 | |
| 254 | - //String cNonce = authHeader.getCNonce(); | |
| 255 | - | |
| 256 | - // nonce计数器,是一个16进制的数值,表示同一nonce下客户端发送出请求的数量 | |
| 257 | - int nc = 1; | |
| 258 | - String ncStr = new DecimalFormat("00000000").format(nc); | |
| 259 | -// String ncStr = new DecimalFormat("00000000").format(Integer.parseInt(nc + "", 16)); | |
| 260 | - MessageDigest messageDigest = MessageDigest.getInstance(DEFAULT_ALGORITHM); | |
| 261 | - String A1 = username + ":" + realm + ":" + "12345678"; | |
| 262 | - String A2 = "REGISTER" + ":" + uri; | |
| 263 | - byte mdbytes[] = messageDigest.digest(A1.getBytes()); | |
| 264 | - String HA1 = toHexString(mdbytes); | |
| 265 | - System.out.println("A1: " + A1); | |
| 266 | - System.out.println("A2: " + A2); | |
| 267 | - | |
| 268 | - mdbytes = messageDigest.digest(A2.getBytes()); | |
| 269 | - String HA2 = toHexString(mdbytes); | |
| 270 | - System.out.println("HA1: " + HA1); | |
| 271 | - System.out.println("HA2: " + HA2); | |
| 272 | - String cnonce = "0a4f113b"; | |
| 273 | - System.out.println("nonce: " + nonce); | |
| 274 | - System.out.println("nc: " + ncStr); | |
| 275 | - System.out.println("cnonce: " + cnonce); | |
| 276 | - System.out.println("qop: " + qop); | |
| 277 | - String KD = HA1 + ":" + nonce; | |
| 278 | - | |
| 279 | - if (qop != null && qop.equals("auth") ) { | |
| 280 | - if (nc != -1) { | |
| 281 | - KD += ":" + ncStr; | |
| 282 | - } | |
| 283 | - if (cnonce != null) { | |
| 284 | - KD += ":" + cnonce; | |
| 285 | - } | |
| 286 | - KD += ":" + qop; | |
| 287 | - } | |
| 288 | - KD += ":" + HA2; | |
| 289 | - System.out.println("KD: " + KD); | |
| 290 | - mdbytes = messageDigest.digest(KD.getBytes()); | |
| 291 | - String mdString = toHexString(mdbytes); | |
| 292 | - System.out.println("mdString: " + mdString); | |
| 293 | - String response = "4f0507d4b87cdecff04bdaf4c96348f0"; | |
| 294 | - System.out.println("response: " + response); | |
| 295 | - } | |
| 242 | +// public static void main(String[] args) throws NoSuchAlgorithmException { | |
| 243 | +// String realm = "3402000000"; | |
| 244 | +// String username = "44010000001180008012"; | |
| 245 | + | |
| 246 | + | |
| 247 | +// String nonce = "07cab60999fbf643264ace27d3b7de8b"; | |
| 248 | +// String uri = "sip:34020000002000000001@3402000000"; | |
| 249 | +// // qop 保护质量 包含auth(默认的)和auth-int(增加了报文完整性检测)两种策略 | |
| 250 | +// String qop = "auth"; | |
| 251 | + | |
| 252 | +// // 客户端随机数,这是一个不透明的字符串值,由客户端提供,并且客户端和服务器都会使用,以避免用明文文本。 | |
| 253 | +// // 这使得双方都可以查验对方的身份,并对消息的完整性提供一些保护 | |
| 254 | +// //String cNonce = authHeader.getCNonce(); | |
| 255 | + | |
| 256 | +// // nonce计数器,是一个16进制的数值,表示同一nonce下客户端发送出请求的数量 | |
| 257 | +// int nc = 1; | |
| 258 | +// String ncStr = new DecimalFormat("00000000").format(nc); | |
| 259 | +// // String ncStr = new DecimalFormat("00000000").format(Integer.parseInt(nc + "", 16)); | |
| 260 | +// MessageDigest messageDigest = MessageDigest.getInstance(DEFAULT_ALGORITHM); | |
| 261 | +// String A1 = username + ":" + realm + ":" + "12345678"; | |
| 262 | +// String A2 = "REGISTER" + ":" + uri; | |
| 263 | +// byte mdbytes[] = messageDigest.digest(A1.getBytes()); | |
| 264 | +// String HA1 = toHexString(mdbytes); | |
| 265 | +// System.out.println("A1: " + A1); | |
| 266 | +// System.out.println("A2: " + A2); | |
| 267 | + | |
| 268 | +// mdbytes = messageDigest.digest(A2.getBytes()); | |
| 269 | +// String HA2 = toHexString(mdbytes); | |
| 270 | +// System.out.println("HA1: " + HA1); | |
| 271 | +// System.out.println("HA2: " + HA2); | |
| 272 | +// String cnonce = "0a4f113b"; | |
| 273 | +// System.out.println("nonce: " + nonce); | |
| 274 | +// System.out.println("nc: " + ncStr); | |
| 275 | +// System.out.println("cnonce: " + cnonce); | |
| 276 | +// System.out.println("qop: " + qop); | |
| 277 | +// String KD = HA1 + ":" + nonce; | |
| 278 | + | |
| 279 | +// if (qop != null && qop.equals("auth") ) { | |
| 280 | +// if (nc != -1) { | |
| 281 | +// KD += ":" + ncStr; | |
| 282 | +// } | |
| 283 | +// if (cnonce != null) { | |
| 284 | +// KD += ":" + cnonce; | |
| 285 | +// } | |
| 286 | +// KD += ":" + qop; | |
| 287 | +// } | |
| 288 | +// KD += ":" + HA2; | |
| 289 | +// System.out.println("KD: " + KD); | |
| 290 | +// mdbytes = messageDigest.digest(KD.getBytes()); | |
| 291 | +// String mdString = toHexString(mdbytes); | |
| 292 | +// System.out.println("mdString: " + mdString); | |
| 293 | +// String response = "4f0507d4b87cdecff04bdaf4c96348f0"; | |
| 294 | +// System.out.println("response: " + response); | |
| 295 | +// } | |
| 296 | 296 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java
| ... | ... | @@ -4,12 +4,10 @@ import com.alibaba.fastjson.JSON; |
| 4 | 4 | import com.alibaba.fastjson.JSONObject; |
| 5 | 5 | import com.genersoft.iot.vmp.conf.MediaConfig; |
| 6 | 6 | import okhttp3.*; |
| 7 | -import org.checkerframework.checker.units.qual.A; | |
| 8 | 7 | import org.jetbrains.annotations.NotNull; |
| 9 | 8 | import org.slf4j.Logger; |
| 10 | 9 | import org.slf4j.LoggerFactory; |
| 11 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | -import org.springframework.beans.factory.annotation.Value; | |
| 13 | 11 | import org.springframework.stereotype.Component; |
| 14 | 12 | |
| 15 | 13 | import java.io.*; | ... | ... |
src/main/java/com/genersoft/iot/vmp/onvif/impl/ONVIFServerIMpl.java
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
| ... | ... | @@ -96,15 +96,16 @@ public class PlayServiceImpl implements IPlayService { |
| 96 | 96 | try { |
| 97 | 97 | String classPath = ResourceUtils.getURL("classpath:").getPath(); |
| 98 | 98 | // System.out.println(classPath); |
| 99 | - String path = classPath + "static/static/snap/"; | |
| 99 | + // 兼容打包为jar的class路径 | |
| 100 | 100 | if(classPath.contains("jar")) { |
| 101 | 101 | classPath = classPath.substring(0, classPath.lastIndexOf(".")); |
| 102 | - classPath = classPath.substring(0, classPath.lastIndexOf("/")); | |
| 103 | - path = classPath + "/snap/"; | |
| 102 | + classPath = classPath.substring(0, classPath.lastIndexOf("/") + 1); | |
| 104 | 103 | } |
| 105 | - if (path.startsWith("file:")) { | |
| 106 | - path = path.substring(path.indexOf(":") + 1, path.length()); | |
| 104 | + if (classPath.startsWith("file:")) { | |
| 105 | + classPath = classPath.substring(classPath.indexOf(":") + 1, classPath.length()); | |
| 107 | 106 | } |
| 107 | + String path = classPath + "static/static/snap/"; | |
| 108 | + // 兼容Windows系统路径(去除前面的“/”) | |
| 108 | 109 | if(System.getProperty("os.name").contains("indows")) { |
| 109 | 110 | path = path.substring(1, path.length()); |
| 110 | 111 | } |
| ... | ... | @@ -116,7 +117,7 @@ public class PlayServiceImpl implements IPlayService { |
| 116 | 117 | StreamInfo streamInfoForSuccess = (StreamInfo)wvpResult.getData(); |
| 117 | 118 | String streamUrl = streamInfoForSuccess.getFmp4(); |
| 118 | 119 | // 请求截图 |
| 119 | - zlmresTfulUtils.getSnap(streamUrl, 5, 1, path, fileName); | |
| 120 | + zlmresTfulUtils.getSnap(streamUrl, 15, 1, path, fileName); | |
| 120 | 121 | } |
| 121 | 122 | } |
| 122 | 123 | System.out.println(path); | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
| ... | ... | @@ -132,15 +132,14 @@ public class DeviceQuery { |
| 132 | 132 | */ |
| 133 | 133 | @ApiOperation("同步设备通道") |
| 134 | 134 | @ApiImplicitParams({ |
| 135 | - @ApiImplicitParam(name="deviceId", value = "设备id", required = true ,dataTypeClass = String.class), | |
| 135 | + @ApiImplicitParam(name="deviceId", value = "设备id", required = true, dataTypeClass = String.class), | |
| 136 | 136 | }) |
| 137 | 137 | @PostMapping("/devices/{deviceId}/sync") |
| 138 | 138 | public DeferredResult<ResponseEntity<Device>> devicesSync(@PathVariable String deviceId){ |
| 139 | 139 | |
| 140 | 140 | if (logger.isDebugEnabled()) { |
| 141 | - } | |
| 142 | 141 | logger.debug("设备通道信息同步API调用,deviceId:" + deviceId); |
| 143 | - | |
| 142 | + } | |
| 144 | 143 | Device device = storager.queryVideoDevice(deviceId); |
| 145 | 144 | cmder.catalogQuery(device, event -> { |
| 146 | 145 | Response response = event.getResponse(); |
| ... | ... | @@ -264,7 +263,7 @@ public class DeviceQuery { |
| 264 | 263 | @ApiImplicitParams({ |
| 265 | 264 | @ApiImplicitParam(name = "deviceId", value = "设备id", required = true, dataTypeClass = String.class), |
| 266 | 265 | @ApiImplicitParam(name = "streamMode", value = "数据流传输模式, 取值:" + |
| 267 | - "UDP(udp传输),TCP-ACTIVE(tcp主动模式,暂不支持),TCP-PASSIVE(tcp被动模式)"), | |
| 266 | + "UDP(udp传输),TCP-ACTIVE(tcp主动模式,暂不支持),TCP-PASSIVE(tcp被动模式)", dataTypeClass = String.class), | |
| 268 | 267 | }) |
| 269 | 268 | @PostMapping("/transport/{deviceId}/{streamMode}") |
| 270 | 269 | public ResponseEntity<PageInfo> updateTransport(@PathVariable String deviceId, @PathVariable String streamMode){ | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java
| ... | ... | @@ -56,7 +56,7 @@ public class GbStreamController { |
| 56 | 56 | */ |
| 57 | 57 | @ApiOperation("移除国标关联") |
| 58 | 58 | @ApiImplicitParams({ |
| 59 | - @ApiImplicitParam(name = "gbStreamParam", value = "GbStreamParam", required = true , | |
| 59 | + @ApiImplicitParam(name = "gbStreamParam", value = "GbStreamParam", required = true, | |
| 60 | 60 | dataTypeClass = GbStreamParam.class), |
| 61 | 61 | }) |
| 62 | 62 | @DeleteMapping(value = "/del") |
| ... | ... | @@ -77,7 +77,7 @@ public class GbStreamController { |
| 77 | 77 | */ |
| 78 | 78 | @ApiOperation("保存国标关联") |
| 79 | 79 | @ApiImplicitParams({ |
| 80 | - @ApiImplicitParam(name = "gbStreamParam", value = "GbStreamParam", required = true , dataTypeClass = GbStreamParam.class), | |
| 80 | + @ApiImplicitParam(name = "gbStreamParam", value = "GbStreamParam", required = true, dataTypeClass = GbStreamParam.class), | |
| 81 | 81 | }) |
| 82 | 82 | @PostMapping(value = "/add") |
| 83 | 83 | @ResponseBody | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/record/RecoderProxyController.java
| ... | ... | @@ -14,6 +14,8 @@ import org.springframework.web.client.RestTemplate; |
| 14 | 14 | |
| 15 | 15 | import javax.servlet.http.HttpServletRequest; |
| 16 | 16 | import javax.servlet.http.HttpServletResponse; |
| 17 | + | |
| 18 | +import java.io.UnsupportedEncodingException; | |
| 17 | 19 | import java.net.URLDecoder; |
| 18 | 20 | |
| 19 | 21 | @RestController |
| ... | ... | @@ -31,7 +33,7 @@ public class RecoderProxyController { |
| 31 | 33 | |
| 32 | 34 | @ResponseBody |
| 33 | 35 | @RequestMapping(value = "/**/**/**", produces = "application/json;charset=UTF-8") |
| 34 | - public Object proxy(HttpServletRequest request, HttpServletResponse response){ | |
| 36 | + public Object proxy(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException{ | |
| 35 | 37 | |
| 36 | 38 | |
| 37 | 39 | String baseRequestURI = request.getRequestURI(); |
| ... | ... | @@ -51,7 +53,7 @@ public class RecoderProxyController { |
| 51 | 53 | mediaInfo.getSdpIp(), |
| 52 | 54 | mediaConfig.getRecordAssistPort(), |
| 53 | 55 | baseRequestURI.substring(baseRequestURI.indexOf(mediaId) + mediaId.length()), |
| 54 | - URLDecoder.decode(request.getQueryString()) | |
| 56 | + URLDecoder.decode(request.getQueryString(), "UTF-8") | |
| 55 | 57 | ); |
| 56 | 58 | // 发送请求 |
| 57 | 59 | RestTemplate restTemplate = new RestTemplate(); | ... | ... |