RequestAttributeResolver class final

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

  1. Looks up the attribute by name in the request's attribute map
  2. Returns the attribute value if found
  3. 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.

Implemented types

Constructors

RequestAttributeResolver()
Resolves method parameters annotated with RequestAttribute by extracting values from request-scoped attributes.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve(ServerHttpRequest request, Parameter parameter, ResolverContext context) Future<Object?>
Resolves the actual value for the method parameter from the current HTTP request.
override
supports(Parameter parameter) bool
Determines whether this resolver can handle the specified method parameter.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited