diff options
Diffstat (limited to 'kvision-modules/kvision-server-jooby')
-rw-r--r-- | kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt index 6cc2b73d..7bb7af06 100644 --- a/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt +++ b/kvision-modules/kvision-server-jooby/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt @@ -446,51 +446,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++}" - routes.add { - call(HttpMethod.POST, "/kv/$routeDef") { req, res -> - val jsonRpcRequest = req.body(JsonRpcRequest::class.java) - @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]) - val injector = req.require(Injector::class.java) - val service = injector.getInstance(serviceClass.java) - GlobalScope.launch(start = CoroutineStart.UNDISPATCHED) { - try { - val result = function.invoke(service, param1, param2, param3) - res.send( - JsonRpcResponse( - id = jsonRpcRequest.id, - result = mapper.writeValueAsString(result) - ) - ) - } catch (e: Exception) { - if (!(e is ServiceException)) LOG.error(e.message, e) - res.send( - JsonRpcResponse( - id = jsonRpcRequest.id, error = e.message ?: "Error", - exceptionType = e.javaClass.canonicalName - ) - ) - } - } - } else { - res.send(JsonRpcResponse(id = jsonRpcRequest.id, error = "Invalid parameters")) - } - }.invoke(this) - } - } - - /** * Binds a given function of the receiver as a tabulator component source * @param function a function of the receiver */ |