Permalink
Browse files

Fix #331 and add documentation about #337

Signed-off-by: Clement Escoffier <clement.escoffier@gmail.com>
  • Loading branch information...
cescoffier committed Sep 12, 2014
1 parent ea33038 commit e89716ca72a653a962d03ce6ba90911c593fb01f
@@ -90,9 +90,23 @@ computation). It includes filters, interceptors, action methods... So it let the
You can write or retrieve data from the request scope as follows:
[source, java]
----
int echo = (int) request().data().get("echo");
request().data().put("echo", echo + 1);
----
The request scope can contain any types of objects, and is cleared once the response is sent back to the client.
The request scope can contain any types of objects, and is cleared once the response is sent back to the client.
Objects from the request scope can be injected as action's method parameters:
[source, java]
@Route(method=HttpMethod.GET, uri="/test")
public Result doIt(@HttpParameter("echo") int echo) {
// ...
}
IMPORTANT: The request scope must be used to avoid using `Thread Local` object. `Thread Local` do not conform to the
Wisdom execution model, and would not be available in async result processing. So, instead of using a `Thread
Local`, put the object into the request scope. By this way, you ensure the object to be available until the end of
the request processing.
@@ -87,7 +87,7 @@ Action methods can receive parameters. Several types of parameters are supported
with `@Parameter`, `@QueryParameter` and `@PathParameter`
2. fields from form are annotated with `@FormParameter`. It's also used for file upload.
3. object built from the request body (for `POST` requests). These parameters are annotated with `@Body`
4. `@HttpParameter` injects an object extracted from the incoming request such as a header, the HTTP
4. `@HttpParameter` injects an object extracted from the incoming request such as a header, request scope data, the HTTP
context, the request and cookies.
5. `@BeanParameter` injects an instance of a class using the other annotations.

0 comments on commit e89716c

Please sign in to comment.