RequestControllers respond to, modify or forward HTTP requests.
This class is intended to be extended. RequestControllers are sent Requests through their receive method, which in turn invokes processRequest. Subclasses should implement processRequest to respond to, modify or forward requests. In some cases, subclasses may also override receive.
A request controller wraps the processing of a request in a try-catch block. If a request controller finishes processing a request and does not respond to it, the Request is passed to the next RequestController. The next RequestController is defined by methods such as pipe, generate, and listen.
- 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
Properties
- documentableChild → APIDocumentable
-
@override, read-only
- logger → Logger
-
read-only
- nextController → RequestController
-
read / write
- 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 generatorFunction()) → RequestController -
A function that instantiates a RequestController to pass a Request to if this instance returns a Request from processRequest.
-
handleError(
Request request, caughtValue, StackTrace trace) → Future<bool> -
Sends an HTTP response for a request that yields an exception or error.
-
listen(
Future<RequestOrResponse> requestControllerFunction(Request request)) → RequestController -
A closure that responds to or forwards a Request.
-
pipe(
RequestController n) → RequestController -
The next RequestController to pass a Request to if this instance returns a Request from processRequest.
-
processRequest(
Request req) → Future<RequestOrResponse> -
Overridden by subclasses to modify or respond to an incoming request.
-
receive(
Request req) → Future -
The mechanism for delivering a Request to this controller for processing.
-
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