restful
methodsnitcorn :: RestfulAction :: defaultinit
nitcorn :: RestfulAction :: deserialize_arg
Deserializeval
from JSON for a parameter typed by static_type
nitcorn :: RestfulAction :: thread_pool
Thread pool used by methods annotated withrestful(async)
nitcorn :: RestfulAction :: thread_pool=
Thread pool used by methods annotated withrestful(async)
nitcorn $ RestfulAction :: SELF
Type of this instance, automatically specialized in every classnitcorn $ RestfulAction :: answer
Prepare aHttpResponse
destined to the client in response to the request
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
nitcorn :: RestfulAction :: defaultinit
nitcorn :: RestfulAction :: deserialize_arg
Deserializeval
from JSON for a parameter typed by static_type
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
nitcorn :: RestfulAction :: thread_pool
Thread pool used by methods annotated withrestful(async)
nitcorn :: RestfulAction :: thread_pool=
Thread pool used by methods annotated withrestful(async)
# Action with `restful` methods
class RestfulAction
super Action
redef fun answer(request, truncated_uri) do return new HttpResponse(400)
# Deserialize `val` from JSON for a parameter typed by `static_type`
#
# Accepts `nullable String` for convenience, but returns `null` when `val == null`.
#
# This method is called by the code generated by `nitrestful`.
# It can be specialized to customize its behavior.
protected fun deserialize_arg(val: nullable String, static_type: String): nullable Object
do
if val == null then return null
var deserializer = new JsonDeserializer(val)
var obj = deserializer.deserialize(static_type)
if deserializer.errors.not_empty then
print_error deserializer.errors.join("\n")
return null
end
return obj
end
# Thread pool used by methods annotated with `restful(async)`
var thread_pool = new ThreadPool is writable
end
lib/nitcorn/restful.nit:63,1--92,3