If I understand you correct, yoiu are talking about a RequestMapper with some heavier logic within ?
Until now the requestmappers we have done, have been rather simplistic, but I see no reason why the RequestMapper couldn't contain logic that accessed the Model-layer.
Something like the following for example :
PHP Code:
if (!defined('DIR_WS_ROOT')) {
define('DIR_WS_ROOT', "http://localhost/Skeleton/");
}
if (!defined('PREG_SPECIALCHARS')) {
define('PREG_SPECIALCHARS', "/.\\+*?[^]\$(){}=!<>|:");
}
class RequestMapper_NodeRequestMapper extends RequestMapper
{
function & mapRequest() {
preg_match("/^".preg_quote(DIR_WS_ROOT, PREG_SPECIALCHARS)."([^\\?\\#]*)/", $_SERVER['REQUEST_URI'], $matches = NULL);
$path = $matches[1];
$nodeFinder =& new NodeFinder();
$node =& $nodeFinder->selectByPath($path);
if (!is_null($node)) {
require_once('ServerPage.php');
return new ServerPage($node->getView());
}
}
}
Bookmarks