There are two types of pattern registered:
-
Fixed named pattern (without trailing slash e.g.
/about
,/home
) -
Rooted path or subtree (with trailing slash e.g.
/
,/about/
)
Let the requested route is RP:
1. If RP ends with trailing slash
1. List down all the Rooted path or subtrees pattern which satisfies the condition: RP.startsWith(pattern)
2. If One or more Patterns satisfies
1. Pick the longest pattern
2. Call the handler associated with picked pattern
3. If No patterns found
1. Response with Not Found routing
2. If RP does not end with trailing slash
1. Find exact match for RP among the registered Fixed named patterns
1. If Match found
1. Call the handler associated with matched pattern
2. If Match not found
1. Check whether a pattern is registered with RP + \
1. If Pattern is registered
1. Redirect to that pattern i.e. RP + \
2. If Pattern is not registered
1. List down all the Rooted path or subtrees pattern which satisfies the condition: RP.startsWith(pattern)
2. If One or more Patterns satisfies
1. Pick the longest pattern
2. Call the handler associated with picked pattern
3. No patterns found
1. Response with Not Found routing