nitcorn :: RestfulAction :: defaultinit
# 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