diff options
Diffstat (limited to 'kvision-modules/kvision-server-ktor/src')
3 files changed, 10 insertions, 7 deletions
diff --git a/kvision-modules/kvision-server-ktor/src/commonMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-ktor/src/commonMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt index 3ba4998d..c035e828 100644 --- a/kvision-modules/kvision-server-ktor/src/commonMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt +++ b/kvision-modules/kvision-server-ktor/src/commonMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt @@ -120,7 +120,8 @@ expect open class KVServiceManager<T : Any>(serviceClass: KClass<T>) { * @param function a function of the receiver */ protected inline fun <reified RET> bindTabulatorRemote( - noinline function: suspend T.(Int?, Int?, List<RemoteFilter>?, List<RemoteSorter>?, String?) -> RemoteData<RET> + noinline function: suspend T.(Int?, Int?, List<RemoteFilter>?, List<RemoteSorter>?, String?) -> RemoteData<RET>, + route: String? = null ) /** diff --git a/kvision-modules/kvision-server-ktor/src/jsMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-ktor/src/jsMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt index c7a35150..4927857f 100644 --- a/kvision-modules/kvision-server-ktor/src/jsMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt +++ b/kvision-modules/kvision-server-ktor/src/jsMain/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt @@ -150,9 +150,10 @@ actual open class KVServiceManager<T : Any> actual constructor(serviceClass: KCl * @param function a function of the receiver */ protected actual inline fun <reified RET> bindTabulatorRemote( - noinline function: suspend T.(Int?, Int?, List<RemoteFilter>?, List<RemoteSorter>?, String?) -> RemoteData<RET> + noinline function: suspend T.(Int?, Int?, List<RemoteFilter>?, List<RemoteSorter>?, String?) -> RemoteData<RET>, + route: String? ) { - val routeDef = "route${this::class.simpleName}${counter++}" + val routeDef = route ?: "route${this::class.simpleName}${counter++}" calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kv/$routeDef", HttpMethod.POST) } @@ -165,7 +166,7 @@ actual open class KVServiceManager<T : Any> actual constructor(serviceClass: KCl noinline function: suspend T.(ReceiveChannel<PAR1>, SendChannel<PAR2>) -> Unit, route: String? ) { - val routeDef = "route${this::class.simpleName}${counter++}" + val routeDef = route ?: "route${this::class.simpleName}${counter++}" calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kvws/$routeDef", HttpMethod.POST) } 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 aee92d31..9d0bf3de 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 @@ -457,7 +457,7 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass: noinline function: suspend T.(ReceiveChannel<PAR1>, SendChannel<PAR2>) -> Unit, route: String? ) { - val routeDef = "route${this::class.simpleName}${counter++}" + val routeDef = route ?: "route${this::class.simpleName}${counter++}" webSocketRequests["/kvws/$routeDef"] = { val wsInjector = call.injector.createChildInjector(WsSessionModule(this)) val service = wsInjector.getInstance(serviceClass.java) @@ -507,9 +507,10 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass: */ @Suppress("TooGenericExceptionCaught") protected actual inline fun <reified RET> bindTabulatorRemote( - noinline function: suspend T.(Int?, Int?, List<RemoteFilter>?, List<RemoteSorter>?, String?) -> RemoteData<RET> + noinline function: suspend T.(Int?, Int?, List<RemoteFilter>?, List<RemoteSorter>?, String?) -> RemoteData<RET>, + route: String? ) { - val routeDef = "route${this::class.simpleName}${counter++}" + val routeDef = route ?: "route${this::class.simpleName}${counter++}" addRoute(HttpMethod.POST, "/kv/$routeDef") { val service = call.injector.createChildInjector(DummyWsSessionModule()).getInstance(serviceClass.java) val jsonRpcRequest = call.receive<JsonRpcRequest>() |