Attempt to determine the action when a route resolves to some page.
Prevent this rule from functioning unless some condition holds, passes in the page requested as part of the context.
Prevent this rule from functioning unless some condition holds, passes in the page requested as part of the context. When the condition doesn't hold, an alternative action may be performed.
Function that takes the requested page and returns true if the page should be rendered.
Response when rule matches but condition doesn't hold.
If response is None
it will be as if this rule doesn't exist and will likely end in the
route-not-found fallback behaviour.
Prevent this rule from functioning unless some condition holds.
Prevent this rule from functioning unless some condition holds. When the condition doesn't hold, an alternative action may be performed.
Response when rule matches but condition doesn't hold.
If response is None
it will be as if this rule doesn't exist and will likely end in the
route-not-found fallback behaviour.
When a route matches a page, compare its Path to what the route would generate for the same page and if they differ, redirect to the generated one.
When a route matches a page, compare its Path to what the route would generate for the same page and if they differ, redirect to the generated one.
Example: If a route matches /issue/dev-23
and returns a Page("DEV", 23)
for which the generate path would be
/issue/DEV-23
, this would automatically redirect /issue/dev-23
to /issue/DEV-23
, and process
/issue/DEV-23
normally using its associated action.
See autoCorrect().
Specify behaviour when a Page
doesn't have an associated Path
or Action
.
Modify the path(es) generated and parsed by this rule.
When a Page
doesn't have an associated Path
or Action
, throw a runtime error.
When a Page
doesn't have an associated Path
or Action
, throw a runtime error.
This is the trade-off for keeping the parsing and generation of known Page
s in sync - compiler proof of
Page
exhaustiveness is sacrificed.
It is recommended that you call RouterConfig.verify as a sanity-check.
Attempt to parse a given path.
Attempt to determine the path for some page.
Add a prefix to the path(es) generated and parsed by this rule.
Add a prefix to the path(es) generated and parsed by this rule.
Add a prefix to the path(es) generated and parsed by this rule.
Unlike prefixPath() when the suffix is non-empty, a slash is added between prefix and suffix.
Compose rules.
A single routing rule. Intended to be composed with other Rules. When all rules are composed, this is turned into a Rules instance.
The type of legal pages.
Attempt to parse a given path.
Attempt to determine the path for some page.
Attempt to determine the action when a route resolves to some page.