Base type that processes Requests.

Instances of this type process requests by creating a Response or passing the Request to nextController. The nextController is set at startup in RequestSink.setupRouter via pipe, generate, or listen.

This class is intended to be subclassed. RequestSink, Router, HTTPController are all examples of this type. Subclasses should implement processRequest to respond to, modify or forward requests.

Mixes-in
  • APIDocumentable
Implemented by

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

Constructors

RequestController()

Default constructor.

Properties

documentableChild APIDocumentable

@override, read-only
logger Logger

An instance of the 'aqueduct' logger.

read-only
nextController RequestController

Receives requests that this controller does not respond to.

read-only
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

Operators

operator ==(other) → bool

The equality operator.

inherited

Methods

applyCORSHeadersIfNecessary(Request req, Response resp) → void

generate(RequestController instantiator()) RequestController

Sets the nextController that will receive a request after this one.

handleError(Request request, caughtValue, StackTrace trace) → Future<bool>

Sends an HTTP response for a request that yields an exception or error.

listen(dynamic process(Request request)) RequestController

Sets the nextController that will receive a request after this one.

pipe(RequestController next) RequestController

Sets the nextController that will receive a request after this one.

processRequest(Request req) → dynamic

Overridden by subclasses to modify or respond to an incoming request.

receive(Request req) → Future

Delivers req to this instance to be processed.

willSendResponse(Response response) → void

Executed prior to Response being sent.

documentAPI(PackagePathResolver resolver) APIDocument

Returns an entire APIDocument describing an OpenAPI specification.

inherited
documentOperations(PackagePathResolver resolver) → List<APIOperation>

Returns all APIOperations this object knows about.

inherited
documentPaths(PackagePathResolver resolver) → List<APIPath>

Returns all APIPath objects this instance knows about.

inherited
documentRequestBodyForOperation(APIOperation operation) APIRequestBody

Returns all APIRequestBodys for operation.

inherited
documentResponsesForOperation(APIOperation operation) → List<APIResponse>

Returns all APIResponses for operation.

inherited
documentSecuritySchemes(PackagePathResolver resolver) → Map<String, APISecurityScheme>

Returns all APISecuritySchemes this instance knows about.

inherited
noSuchMethod(Invocation invocation) → dynamic

Invoked when a non-existent method or property is accessed.

inherited
toString() → String

Returns a string representation of this object.

inherited