aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2019-02-16 02:39:44 +0100
committerRobert Jaros <rjaros@finn.pl>2019-02-16 02:39:44 +0100
commit7120b09bfebb7ab0c562c6b5db7d63a1b9a772d5 (patch)
tree122a103b94b7d990b6956aa169c4d8f9af171c5b /kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl
parentf1bbb0293b795f192fdef6e3ac8fc465232838d1 (diff)
downloadkvision-7120b09bfebb7ab0c562c6b5db7d63a1b9a772d5.tar.gz
kvision-7120b09bfebb7ab0c562c6b5db7d63a1b9a772d5.tar.bz2
kvision-7120b09bfebb7ab0c562c6b5db7d63a1b9a772d5.zip
Refactor main controller for Spring Boot. Enable auto-configuration.
Diffstat (limited to 'kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl')
-rw-r--r--kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVController.kt6
-rw-r--r--kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt27
2 files changed, 3 insertions, 30 deletions
diff --git a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVController.kt b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVController.kt
index da47c750..f8006857 100644
--- a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVController.kt
+++ b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVController.kt
@@ -33,7 +33,7 @@ import javax.servlet.http.HttpServletResponse
open class KVController {
@Autowired
- lateinit var kvServer: KVServer
+ lateinit var services: List<KVServiceManager<*>>
@Autowired
lateinit var applicationContext: ApplicationContext
@@ -44,7 +44,7 @@ open class KVController {
)
open fun kVMapping(req: HttpServletRequest, res: HttpServletResponse) {
val routeUrl = req.requestURI
- val route = kvServer.services.mapNotNull {
+ val route = services.mapNotNull {
when (req.method) {
"GET" -> it.getRequests[routeUrl]
"POST" -> it.postRequests[routeUrl]
@@ -61,4 +61,4 @@ open class KVController {
}
}
-}
+} \ No newline at end of file
diff --git a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt
deleted file mode 100644
index e8dee5cc..00000000
--- a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVServer.kt
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2017-present Robert Jaros
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-package pl.treksoft.kvision.remote
-
-/**
- * A Spring boot based server.
- */
-open class KVServer(val services: List<KVServiceManager<*>>)