HttpResponse
destined to the client in response to the request
nitcorn :: Action :: defaultinit
nitcorn :: Action :: prepare_respond_and_close
Full to arequest
with sending the response and closing of the http_server
nitcorn :: log $ Action :: prepare_respond_and_close
Full to arequest
with sending the response and closing of the http_server
HttpResponse
destined to the client in response to the request
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
nitcorn :: Action :: defaultinit
core :: Object :: defaultinit
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: output_class_name
Display class name on stdout (debug only).nitcorn :: Action :: prepare_respond_and_close
Full to arequest
with sending the response and closing of the http_server
redef abstract class Action
# Prepare a `HttpResponse` destined to the client in response to the `request`
#
# `request` is fully formed request object with a reference to the session
# if one already exists.
#
# `truncated_uri` is the ending of the full request URI, truncated from the route
# leading to this `Action`.
fun answer(request: HttpRequest, truncated_uri: String): HttpResponse is abstract
# 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
end
lib/nitcorn/reactor.nit:99,1--121,3
redef class Action
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
end
lib/nitcorn/log.nit:23,1--41,3