RequestController generate(RequestController generatorFunction())

A function that instantiates a RequestController to pass a Request to if this instance returns a Request from processRequest.

Request controllers are chained together to form a pipeline that a request travels through to be responded to. When this instance returns a Request from processRequest, generatorFunction is called to instantiate a RequestController. The Request is then sent to the new RequestController. RequestControllers that have properties that change depending on the incoming Request - like HTTPController - must be generated for each Request. This avoids having a RequestControllers properties change during the processing of a request due to asynchronous behavior.

This method returns a RequestController that further RequestControllers can be chained to.

See also pipe and listen.

Source

RequestController generate(RequestController generatorFunction()) {
  this.nextController = new _RequestControllerGenerator(generatorFunction);
  return this.nextController;
}