request
with sending the response and closing of the http_server
Must users only need to implement answer
, this method is for advanced use only.
It can be used to delay an answer until an event is raised or work is done on a different thread.
By default this method calls answer
, relays the response to http_server.respond
and closes http_server
.
# Full to a `request` with sending the response and closing of the `http_server`
#
# Must users only need to implement `answer`, this method is for advanced use only.
# It can be used to delay an answer until an event is raised or work is done on a different thread.
#
# By default this method calls `answer`, relays the response to `http_server.respond` and closes `http_server`.
protected fun prepare_respond_and_close(request: HttpRequest, truncated_uri: String, http_server: HttpServer)
do
var response = answer(request, truncated_uri)
http_server.respond response
http_server.close
end
lib/nitcorn/reactor.nit:109,2--120,4
redef fun prepare_respond_and_close(request, truncated_uri, http_server) do
if not log_nitcorn_actions then
super
return
end
print "{http_server.remote_address}: {class_name} prepare for url:'{request.url}' body:'{request.body}' cookie:'{request.cookie.join(",", ":")}'"
var clock = new Clock
super
var perf = sys.perfs[class_name]
perf.add(clock.lapse)
if perf.count % perfs_print_period == 0 then print "{class_name} perfs: {perf}:"
end
lib/nitcorn/log.nit:25,2--40,4