RequestAttributeResolver constructor
const
RequestAttributeResolver()
Resolves method parameters annotated with RequestAttribute by extracting values from request-scoped attributes.
Request attributes are typically set by filters, interceptors, or previous processing steps and are available for the duration of a single request.
Resolution Process
- Looks up the attribute by name in the request's attribute map
- Returns the attribute value if found
- Handles required validation and default values
Example
For a request with attribute authenticatedUser set to a User object
and annotation @RequestAttribute('authenticatedUser'), this resolver
would return the User object.
Common Use Cases
- Authentication context from security filters
- Request processing metadata
- Cross-cutting concern data
Error Handling
Throws InvalidArgumentException when a required request attribute is missing
and no default value is provided.
Thread Safety
This resolver is stateless and thread-safe.
Implementation
const RequestAttributeResolver();