include abstract method

Future include(
  1. HttpConnect connect,
  2. String uri, {
  3. HttpRequest? request,
  4. HttpResponse? response,
})

Includes the given uri. *

  • If request and/or response is ignored, connect's request and/or response is assumed.
  • If uri is null, connect.uri is assumed, i.e., includes the same handler.
  • After calling this method, the caller shall write the output stream in then, since
  • the request handler for the given URI might handle it asynchronously. For example,
  • include(connect, "another");
    
  • connect.response.write("<p>More content</p>");
    
  • ...
    
    • uri - the URI to chain. If omitted, it is the same as connect's.
  • It can contain the query string too.
  • ##Difference between forward and include
  • forward and include are almost the same, except
    • The included request handler won't be able to generate any HTTP headers
  • (it is the job of the caller). Any updates to HTTP headers in the included
  • request handler are simply ignored.
  • It also implies before calling forward, no content shall be output.
  • Otherwise, it will cause exception if the forwarded page updates the HTTP headers.

Implementation

Future include(HttpConnect connect, String uri, {
  HttpRequest? request, HttpResponse? response});