Web request routing

Until v6.1 Aida used only an URLResolver for two-way url to domain object (and vice versa) resolving. But there is a need for more flexible request routing and to ease the URLResolver from routing where one-way is good enough (like static file serving).

That's why a WebRouter class is introduced in Aida 6.1.  It routes a web request according to the url pattern to the appropriate request handler. By default this is just an URLResolver.

Default routes and their url patterns are (in exact order):

  1.  '/*' -> anURLResolver

Url pattern is simply a matching criteria used in Smalltalk #match: method for string matching. It match a relative Url of web request (without query part) to the specified url pattern of a route. Url pattern is case insensitive.

Examples:

  • '/*' matches all Urls
  • '/img/* mathces Urls starting with /img/, like /img/common/myimage.jpg
  • '*/person/*' matches urls which contains this string in the middle, like /site/person/myname