+
+ # Thread pool used by methods annotated with `restful(async)`
+ var thread_pool = new ThreadPool is writable
+end
+
+# Thread dedicated to a single `request`
+abstract class RestfulTask
+ super Task
+
+ # Type of `action`
+ type A: RestfulAction
+
+ # Receiver action
+ var action: A
+
+ # Request that created this thread
+ var request: HttpRequest
+
+ # Server handling the `request`
+ var http_server: HttpServer
+
+ # Indirection to the real method in `action`
+ protected fun indirect_restful_method: HttpResponse is abstract
+
+ redef fun main
+ do
+ var response = indirect_restful_method
+ http_server.respond response
+ http_server.close
+ end