ResponseRedirect constructor
Constructor.
The response will redirect the browser to addr
, which can be
a relative to the deployment URL (i.e. starts with "~/") or a real URI
(absolute or relative).
The status
must be a redirection HTTP status code.
The default status is HttpStatus.seeOther (303). Other commonly used values are HttpStatus.movedPermanently (301) and HttpStatus.movedTemporarily (302).
The value of HttpStatus.temporaryRedirect (307) is used when the method is preserved. That is, GET request is redirected to a GET request and a POST request is redirected to a POST request. Old browsers might not support this status code.
For more information on HTTP status codes, see www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3
Implementation
ResponseRedirect(String addr, {int status = HttpStatus.seeOther})
: _addr = addr,
super() {
if (status < 300 || 399 < status) {
throw ArgumentError.value(
status, 'status', 'ResponseRedirect: not a redirection HTTP status');
}
this.status = status;
if (addr.isEmpty) {
throw ArgumentError.value(addr, 'addr', 'ResponseRedirect: empty string');
}
}