CoroutineInvocationHandler

class CoroutineInvocationHandler(    val asyncContextProvider: Provider<AsyncContext>,     val originalObjectProvider: () -> Any,     val originalInvocable: Invocable,     val shouldIgnoreReturn: Boolean) : InvocationHandler, CoroutineScope

InvocationHandler that runs a jersey resource method implemented by a suspend function in a coroutine, and bridges the return/exception value into an AsyncContext for the request, allowing suspend functions to transparently implement jersey async requests.

Resource classes/methods annotated with AsyncDispatcher can specify which standard coroutine dispatcher to launch the coroutine with, otherwise defaults to Dispatchers.Unconfined. Additionally, if a resource class implements CoroutineScope, that scope is used to launch the coroutine.

Constructors

Link copied to clipboard
fun CoroutineInvocationHandler(    asyncContextProvider: Provider<AsyncContext>,     originalObjectProvider: () -> Any,     originalInvocable: Invocable,     shouldIgnoreReturn: Boolean)

Functions

Link copied to clipboard
private suspend fun executeCoroutine(    originalObject: Any,     args: Array<out Any>?,     asyncContext: AsyncContext)
Link copied to clipboard
open operator override fun invoke(    proxy: Any,     method: Method,     args: Array<out Any>?): Any?

Properties

Link copied to clipboard
private val asyncContextProvider: Provider<AsyncContext>
Link copied to clipboard
open override val coroutineContext: CoroutineContext
Link copied to clipboard
private val originalInvocable: Invocable
Link copied to clipboard
private val originalObjectProvider: () -> Any
Link copied to clipboard
private val shouldIgnoreReturn: Boolean