forward abstract method
Forward the given connect
to the given uri
.
*
- If
request
and/orresponse
is ignored,connect
's request and/or response is assumed. - If
uri
is null,connect.uri
is assumed, i.e., forwarded to 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,
-
await forward(connect, "another");
-
connect.response.write("<p>More content</p>");
-
...
-
uri
- the URI to chain. If omitted, it is the same asconnect
'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.
- Notice that the whitespaces at the beginning of a RSP file won't be output, so the
- following is correct:
-
[:if !isAuthenticated()]
-
[:forward "/login" /]
-
[:/if]
Implementation
Future forward(HttpConnect connect, String uri, {
HttpRequest? request, HttpResponse? response});