Class CoroutineContextService

All Implemented Interfaces:
Unwrappable, HttpService, Service<HttpRequest,HttpResponse>

public final class CoroutineContextService extends SimpleDecoratingHttpService
Decorates an HttpService to configure the coroutine context which is used as an initial context of annotated services' suspending functions.

Example:


 > serverBuilder
 >     .annotatedService(object {
 >         @Get("/users/{uid}")
 >         suspend fun foo(@Param("uid") uid: String): HttpResponse {
 >             ...
 >         }
 >     })
 >     .decorator(CoroutineContextService.newDecorator { ctx ->
 >         CoroutineName(ctx.config().defaultServiceNaming.serviceName(ctx) ?: "name")
 >     })
 
 

Note that ctx.eventLoop() is used as coroutine dispatcher by default, and ctx.blockingTaskExecutor() is used if `useBlockingTaskExecutor` is set to true or methods are annotated with @Blocking.