A partial class for implementing an HTTPController that has a few conveniences for executing Querys.
Instances of QueryController are HTTPControllers that have a pre-baked Query available. This Query's type -
the ManagedObject type is operates on - is defined by InstanceType.
The values of query are set based on the HTTP method, HTTP path and request body. Prior to executing a responder method in subclasses of QueryController, the query will have the following attributes under the following conditions:
- The Query will always have a type argument that matches
InstanceType. - If the request contains a path variable that matches the name of the primary key of
InstanceType, the Query will setits Query.where to match on the ManagedObject whose primary key is that value of the path parameter. - If the Request contains a body, it will be decoded per the acceptedContentTypes and deserialized into the Query.values property via ManagedObject.readFromMap.
- Inheritance
- Object
- RequestController
- HTTPController
- QueryController
Constructors
- QueryController([ManagedContext context ])
-
Create an instance of QueryController. By default,
contextis the ManagedContext.defaultContext.
Properties
- query → Query<InstanceType>
-
A query representing the values received from the request being processed.
read / write - acceptedContentTypes → List<ContentType>
-
Types of content this HTTPController will accept.
read / write, inherited - documentableChild → APIDocumentable
-
@override, read-only, inherited
- hashCode → int
-
The hash code for this object.
read-only, inherited - logger → Logger
-
An instance of the 'aqueduct' logger.
read-only, inherited - nextController → RequestController
-
Receives requests that this controller does not respond to.
read-only, inherited - pathVariables → Map<String, String>
-
Parameters parsed from the URI of the request, if any exist.
read-only, inherited - policy → CORSPolicy
-
The CORS policy of this controller.
read / write, inherited - request → Request
-
The request being processed by this HTTPController.
read / write, inherited - responseContentType → ContentType
-
The default content type of responses from this HTTPController.
read / write, inherited - runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Operators
-
operator ==(
other) → bool -
The equality operator.
inherited
Methods
-
didDecodeRequestBody(
HTTPRequestBody body) → void -
Callback to indicate when a request body has been processed.
-
willProcessRequest(
Request req) → dynamic -
Executed prior to handling a request, but after the
requesthas been set. -
applyCORSHeadersIfNecessary(
Request req, Response resp) → void -
inherited
-
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 foroperation.inherited -
documentSecuritySchemes(
PackagePathResolver resolver) → Map<String, APISecurityScheme> -
Returns all APISecuritySchemes this instance knows about.
inherited -
generate(
RequestController instantiator()) → RequestController -
Sets the nextController that will receive a request after this one.
inherited -
handleError(
Request request, caughtValue, StackTrace trace) → Future<bool> -
Sends an HTTP response for a request that yields an exception or error.
inherited -
listen(
dynamic process(Request request)) → RequestController -
Sets the nextController that will receive a request after this one.
inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed.
inherited -
pipe(
RequestController next) → RequestController -
Sets the nextController that will receive a request after this one.
inherited -
processRequest(
Request req) → Future<RequestOrResponse> -
Overridden by subclasses to modify or respond to an incoming request.
inherited -
receive(
Request req) → Future -
Delivers
reqto this instance to be processed.inherited -
toString(
) → String -
Returns a string representation of this object.
inherited -
willDecodeRequestBody(
HTTPRequestBody body) → void -
Callback invoked prior to decoding a request body.
inherited -
willSendResponse(
Response response) → void -
Executed prior to Response being sent.
inherited