map method
Maps the given URI to the given handler. *
-
uri
- a regular expression used to match the request URI.
- If you can name a group by prefix with a name, such as
'/dead-link(info:.*)'
. -
handler
- the handler for handling the request, or another URI that this request
- will be forwarded to. If the value is a URI and the key has named groups, the URI can
- refer to the group with
(the_group_name)
. - For example:
'/dead-link(info:.*)': '/new-link(info)'
. - If it is null, it means removal.
-
preceding
- whether to make the mapping preceding any previous mappings.
- In other words, if true, this mapping will be interpreted first.
Implementation
@override
void map(String uri, handler, {preceding = false}) {
if (handler != null && handler is! Function && handler is! String)
throw ServerError("URI mapping: function (renderer) or string (URI) is required for $uri");
_map(_uriMapping, uri, handler, preceding);
_uriCache.reset();
}