Add @RequestAttribute with servlet-based support
Issue: SPR-13894
This commit is contained in:
@@ -1254,6 +1254,7 @@ multiple requests are allowed to access a session concurrently.
|
||||
session attributes (e.g. user authentication object) as opposed to model
|
||||
attributes temporarily stored in the session as part of a controller workflow
|
||||
via `@SessionAttributes`.
|
||||
* `@RequestAttribute` annotated parameters for access to request attributes.
|
||||
* `HttpEntity<?>` parameters for access to the Servlet request HTTP headers and
|
||||
contents. The request stream will be converted to the entity body using
|
||||
++HttpMessageConverter++s. See <<mvc-ann-httpentity>>.
|
||||
@@ -1794,6 +1795,23 @@ workflow consider using `SessionAttributes` as described in
|
||||
<<mvc-ann-sessionattrib>>.
|
||||
|
||||
|
||||
[[mvc-ann-requestattrib]]
|
||||
==== Using @RequestAttribute to access request attributes
|
||||
|
||||
Similar to `@SessionAttribute` the `@RequestAttribute` annotation can be used to
|
||||
access pre-existing request attributes created by a filter or interceptor:
|
||||
|
||||
[source,java,indent=0]
|
||||
[subs="verbatim,quotes"]
|
||||
----
|
||||
@RequestMapping("/")
|
||||
public String handle(**@RequestAttribute** Client client) {
|
||||
// ...
|
||||
}
|
||||
----
|
||||
|
||||
|
||||
|
||||
|
||||
[[mvc-ann-form-urlencoded-data]]
|
||||
==== Working with "application/x-www-form-urlencoded" data
|
||||
|
||||
@@ -665,6 +665,7 @@ Spring 4.3 also improves the caching abstraction as follows:
|
||||
* New `@RestControllerAdvice` annotation with combined `@ControllerAdvice` with `@ResponseBody` semantics.
|
||||
* `@ResponseStatus` supported on the class level and inherited on all methods.
|
||||
* New `@SessionAttribute` annotation for access to session attributes (see <<mvc-ann-sessionattrib-global, example>>).
|
||||
* New `@RequestAttribute` annotation for access to session attributes (see <<mvc-ann-requestattrib, example>>).
|
||||
* `AsyncRestTemplate` supports request interception.
|
||||
|
||||
=== WebSocket Messaging Improvements
|
||||
|
||||
Reference in New Issue
Block a user