Explorar el Código

add resource not found for unregistered client

herlanS_ hace 3 años
padre
commit
a4fe5d3516

+ 1 - 8
src/main/kotlin/co/id/datacomsolusindo/ipphonebridge/BridgeFIlter.kt

@@ -76,18 +76,11 @@ class BridgeFilter(private val template: SimpMessagingTemplate, val resourceLoad
         val client = splitPath[1]
         val toPath = "/" + splitPath.takeLast(splitPath.size - 1).joinToString("/")
         val clientNumber = client.toIntOrNull()
-        if (clientNumber != null && clientNumber > 0 && clientNumber <= 999) {
+        if (clientNumber != null && clientNumber > 0 && clientNumber <= 999 && ClientHolder.get().containsKey(clientNumber.toString())) {
             val search = isResourceAvailable(toPath)
             if (search != null && !search.endsWith("assets/bootstrap.js")) {
                 res.sendRedirect("/resources/$search")
             } else {
-                if(!ClientHolder.get().containsKey(clientNumber.toString())){
-                    res.status = HttpStatus.NOT_FOUND.value()
-                    res.writer.write("{\"message\":\"resource not found\"}")
-                    res.flushBuffer()
-                    return
-
-                }
                 LogManager.getLogger("client-$client")
                     .info("Request Start, UA: " + req.getHeader("User-Agent") + " From: " + InetAddress.getLocalHost().hostAddress + " To: " + req.requestURL.toString() + "?" + req.queryString)