aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-server-ktor
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2020-02-09 00:02:38 +0100
committerRobert Jaros <rjaros@finn.pl>2020-02-09 00:02:38 +0100
commit321fadf3b8381b9d33cb6c5208d0bf6c4d7923f7 (patch)
tree1cb143c9756044d27c53302836d69980e1474450 /kvision-modules/kvision-server-ktor
parentf8ff7ea49d2154d249c79a8c9591614793213e9e (diff)
downloadkvision-321fadf3b8381b9d33cb6c5208d0bf6c4d7923f7.tar.gz
kvision-321fadf3b8381b9d33cb6c5208d0bf6c4d7923f7.tar.bz2
kvision-321fadf3b8381b9d33cb6c5208d0bf6c4d7923f7.zip
Simplify bindings definitions for remote components (select, typeahead)
Diffstat (limited to 'kvision-modules/kvision-server-ktor')
-rw-r--r--kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt46
1 files changed, 0 insertions, 46 deletions
diff --git a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
index 19bb8db4..d3fde5c7 100644
--- a/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
+++ b/kvision-modules/kvision-server-ktor/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt
@@ -449,52 +449,6 @@ actual open class KVServiceManager<T : Any> actual constructor(val serviceClass:
}
/**
- * Binds a given function of the receiver as a select options source
- * @param function a function of the receiver
- */
- @Suppress("TooGenericExceptionCaught")
- protected actual fun bindSelectRemote(
- function: suspend T.(String?, String?, String?) -> List<RemoteOption>
- ) {
- val routeDef = "route${this::class.simpleName}${counter++}"
- addRoute(HttpMethod.POST, "/kv/$routeDef") {
- val service = call.injector.createChildInjector(DummyWsSessionModule()).getInstance(serviceClass.java)
- val jsonRpcRequest = call.receive<JsonRpcRequest>()
- @Suppress("MagicNumber")
- if (jsonRpcRequest.params.size == 3) {
- val param1 = getParameter<String?>(jsonRpcRequest.params[0])
- val param2 = getParameter<String?>(jsonRpcRequest.params[1])
- val param3 = getParameter<String?>(jsonRpcRequest.params[2])
- try {
- val result = function.invoke(service, param1, param2, param3)
- call.respond(
- JsonRpcResponse(
- id = jsonRpcRequest.id,
- result = mapper.writeValueAsString(result)
- )
- )
- } catch (e: Exception) {
- if (!(e is ServiceException)) LOG.error(e.message, e)
- call.respond(
- JsonRpcResponse(
- id = jsonRpcRequest.id,
- error = e.message ?: "Error",
- exceptionType = e.javaClass.canonicalName
- )
- )
- }
- } else {
- call.respond(
- JsonRpcResponse(
- id = jsonRpcRequest.id,
- error = "Invalid parameters"
- )
- )
- }
- }
- }
-
- /**
* Binds a given function of the receiver as a tabulator component source
* @param function a function of the receiver
*/