nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge: doc: fixed some typos and other misc. corrections
[nit.git]
/
lib
/
nitcorn
/
restful.nit
diff --git
a/lib/nitcorn/restful.nit
b/lib/nitcorn/restful.nit
index
abaaf0d
..
a7580a4
100644
(file)
--- a/
lib/nitcorn/restful.nit
+++ b/
lib/nitcorn/restful.nit
@@
-32,7
+32,7
@@
# Arguments that are `nullable` are optional,
# if they are missing `null` is passed to the `restful` method.
#
# Arguments that are `nullable` are optional,
# if they are missing `null` is passed to the `restful` method.
#
-# The annotation accepts two kinds of arguments, in any order:
+# The annotation accepts three kinds of arguments, in any order:
#
# * String literals rename or add an alias for the HTTP resource.
# By default, the name of the HTTP resource is the name of the `restful` method.
#
# * String literals rename or add an alias for the HTTP resource.
# By default, the name of the HTTP resource is the name of the `restful` method.
@@
-42,6
+42,10
@@
# * Ids such as `GET`, `POST`, `PUT` and `DELETE` restrict which HTTP methods
# are accepted. By default, all HTTP methods are accepted.
#
# * Ids such as `GET`, `POST`, `PUT` and `DELETE` restrict which HTTP methods
# are accepted. By default, all HTTP methods are accepted.
#
+# * The `async` keyword triggers executing calls to this service asynchronously
+# by the `thread_pool` attribute of the `RestfulAction`.
+# By default, each call are executed on the same thread in a FIFO order.
+#
# See the example at `lib/nitcorn/examples/restful_annot.nit` or
# a real world use case at `contrib/benitlux/src/server/benitlux_controller.nit`.
#
# See the example at `lib/nitcorn/examples/restful_annot.nit` or
# a real world use case at `contrib/benitlux/src/server/benitlux_controller.nit`.
#
@@
-62,18
+66,18
@@
class RestfulAction
redef fun answer(request, truncated_uri) do return new HttpResponse(400)
redef fun answer(request, truncated_uri) do return new HttpResponse(400)
- # Service to deserialize arguments from JSON
+ # 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.
#
# 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): nullable Object
+ protected fun deserialize_arg(val: nullable String, static_type: String): nullable Object
do
if val == null then return null
var deserializer = new JsonDeserializer(val)
do
if val == null then return null
var deserializer = new JsonDeserializer(val)
- var obj = deserializer.deserialize
+ var obj = deserializer.deserialize(static_type)
if deserializer.errors.not_empty then
print_error deserializer.errors.join("\n")
if deserializer.errors.not_empty then
print_error deserializer.errors.join("\n")