Controller class

Base class for request handling objects.

A controller is a discrete processing unit for requests. These units are linked together to form a series of steps that fully handle a request.

Subclasses must implement handle to respond to, modify or forward requests. This class must be subclassed. Router and ResourceController are common subclasses.

Implemented types




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


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


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

Static Properties

includeErrorDetailsInServerErrorResponses ↔ bool
Returns a stacktrace and additional details about how the request's processing in the HTTP response. [...]
read / write
letUncaughtExceptionsEscape ↔ bool
Whether or not to allow uncaught exceptions escape request controllers. [...]
read / write