aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-server-ktor/src/jvmMain/kotlin/pl
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2020-03-12 13:15:21 +0100
committerRobert Jaros <rjaros@finn.pl>2020-03-12 13:15:21 +0100
commitb862dc8bcde84023a001deabaaa7fe119bd649e5 (patch)
treefe26b736df0d24f3dc4a177a1d3d6c60f5a5c41e /kvision-modules/kvision-server-ktor/src/jvmMain/kotlin/pl
parentf09f567cc46717887d24d3e197e09605ddf414b7 (diff)
downloadkvision-b862dc8bcde84023a001deabaaa7fe119bd649e5.tar.gz
kvision-b862dc8bcde84023a001deabaaa7fe119bd649e5.tar.bz2
kvision-b862dc8bcde84023a001deabaaa7fe119bd649e5.zip
Ktor upgrade to 1.3.2
Diffstat (limited to 'kvision-modules/kvision-server-ktor/src/jvmMain/kotlin/pl')
-rw-r--r--kvision-modules/kvision-server-ktor/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt9
1 files changed, 4 insertions, 5 deletions
diff --git a/kvision-modules/kvision-server-ktor/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-ktor/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
index d516f2b3..25771091 100644
--- a/kvision-modules/kvision-server-ktor/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
+++ b/kvision-modules/kvision-server-ktor/src/jvmMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -38,7 +38,6 @@ import io.ktor.routing.get
import io.ktor.routing.options
import io.ktor.routing.post
import io.ktor.routing.put
-import io.ktor.util.KtorExperimentalAPI
import io.ktor.util.pipeline.PipelineContext
import io.ktor.websocket.WebSocketServerSession
import io.ktor.websocket.webSocket
@@ -63,9 +62,7 @@ import kotlin.reflect.KClass
/**
* Multiplatform service manager for Ktor.
*/
-@KtorExperimentalAPI
-@OptIn(ExperimentalCoroutinesApi::class)
-@Suppress("LargeClass", "TooManyFunctions")
+@Suppress("LargeClass", "TooManyFunctions", "BlockingMethodInNonBlockingContext")
actual open class KVServiceManager<T : Any> actual constructor(val serviceClass: KClass<T>) {
companion object {
@@ -399,6 +396,7 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
* @param function a function of the receiver
* @param route a route
*/
+ @OptIn(ExperimentalCoroutinesApi::class)
@Suppress("EmptyCatchBlock")
protected actual inline fun <reified PAR1 : Any, reified PAR2 : Any> bind(
noinline function: suspend T.(ReceiveChannel<PAR1>, SendChannel<PAR2>) -> Unit,
@@ -465,8 +463,10 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
val param1 = getParameter<Int?>(jsonRpcRequest.params[0])
val param2 = getParameter<Int?>(jsonRpcRequest.params[1])
val param3 = getParameter<List<RemoteFilter>?>(jsonRpcRequest.params[2])
+
@Suppress("MagicNumber")
val param4 = getParameter<List<RemoteSorter>?>(jsonRpcRequest.params[3])
+
@Suppress("MagicNumber")
val param5 = getParameter<String?>(jsonRpcRequest.params[4])
try {
@@ -532,7 +532,6 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
/**
* A function to generate routes based on definitions from the service manager.
*/
-@KtorExperimentalAPI
fun <T : Any> Route.applyRoutes(serviceManager: KVServiceManager<T>) {
serviceManager.getRequests.forEach { (path, handler) ->
get(path, handler)