Prechádzať zdrojové kódy

change resource to web

herlanS_ 4 rokov pred
rodič
commit
20f14b40a6

+ 1 - 0
.gitignore

@@ -23,6 +23,7 @@ target/
 /nbproject/private/
 /nbbuild/
 /dist/
+/web/**
 /nbdist/
 /.nb-gradle/
 build/

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

@@ -44,7 +44,7 @@ class SimpleCORSFilter : Filter {
         val response = resp as HttpServletResponse
         val request = req as HttpServletRequest
         response.setHeader("Access-Control-Allow-Origin", "*")
-        response.setHeader("Access-Control-Allow-Methods", "PATCH,POST,GET,OPTIONS,DELETE")
+        response.setHeader("Access-Control-Allow-Methods", "PATCH,PUT,POST,GET,OPTIONS,DELETE")
         response.setHeader("Access-Control-Max-Age", "3600")
         response.setHeader("Access-Control-Allow-Headers", "x-requested-with, authorization, Content-Type, Authorization, credential, X-XSRF-TOKEN")
         if ("OPTIONS".equals(request.method, ignoreCase = true)) {
@@ -136,7 +136,7 @@ class BridgeFilter(private val template: SimpMessagingTemplate, val resourceLoad
         if (splPath.size >= itr) {
             val search = splPath.joinToString("/")
             println("search $search")
-            val resource = resourceLoader.getResource("file:dist/$search")
+            val resource = resourceLoader.getResource("file:web/$search")
             return if (resource.exists() && resource.file.isFile) {
                 return search
             } else {
@@ -207,8 +207,8 @@ class BridgeRestController {
 class MvcConfig : WebMvcConfigurer {
     override fun addResourceHandlers(registry: ResourceHandlerRegistry) {
         registry
-                .addResourceHandler("/resources/**")
-                .addResourceLocations("file:dist/")
+                .addResourceHandler("resources/**")
+                .addResourceLocations("file:web/")
                 .setCachePeriod(3600 * 24 * 30)
                 .resourceChain(true)
                 .addResolver(PathResourceResolver())