Recyclable<T> class

An interface that Controller subclasses implement to generate a new controller for each request.

If a Controller implements this interface, a new Controller is created for each request. Controllers must implement this interface if they declare setters or non-final properties, as those properties could change during request handling.

A controller that implements this interface can store information that is not tied to the request to be reused across each instance of the controller type by implementing recycledState and restore. Use these methods when a controller needs to construct runtime information that only needs to occur once per controller type.

Implemented types
Implementers

Constructors

Recyclable()

Properties

recycledState → T
Returns state information that is reused across instances of this type. [...]
read-only
hashCode → int
The hash code for this object.
read-only, inherited
logger Logger
An instance of the 'aqueduct' logger.
read-only, inherited
nextController Controller
Receives requests that this controller does not respond to. [...]
read-only, inherited
policy CORSPolicy
The CORS policy of this controller.
read / write, inherited
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited

Methods

restore(T state) → void
Provides a new instance of this type with the recycledState of this type. [...]
applyCORSHeadersIfNecessary(Request req, Response resp) → void
inherited
didAddToChannel() → void
Lifecycle callback, invoked after added to channel, but before any requests are served. [...]
inherited
documentComponents(APIDocumentContext context) → void
Tells this object to add its components to context. [...]
inherited
documentOperations(APIDocumentContext context, String route, APIPath path) → Map<String, APIOperation>
Tells this object to return all APIOperations it handles. [...]
inherited
documentPaths(APIDocumentContext context) → Map<String, APIPath>
Tells this object to return all APIPaths it handles. [...]
inherited
handle(Request request) → FutureOr<RequestOrResponse>
The primary request handling method of this object. [...]
inherited
handleError(Request request, dynamic caughtValue, StackTrace trace) → Future
Sends an HTTP response for a request that yields an exception or error. [...]
inherited
Links a controller to the receiver to form a request channel. [...]
inherited
linkFunction(FutureOr<RequestOrResponse> handle(Request request)) Linkable
Links a function controller to the receiver to form a request channel. [...]
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
receive(Request req) → Future
Delivers req to this instance to be processed. [...]
inherited
toString() → String
Returns a string representation of this object.
inherited
willSendResponse(Response response) → void
Executed prior to Response being sent. [...]
inherited

Operators

operator ==(dynamic other) → bool
The equality operator.
inherited