public function resolve($route, $req, $res, array $args)
    {
        $result = false;
        if (is_array($route) || is_string($route)) {
            // method name and controller supplied
            if (is_string($route) && $req->params('controller')) {
                $route = [$req->params('controller'), $route];
            // method name supplied
            } elseif (is_string($route)) {
                $route = [$this->defaultController, $route];
            // no method name? fallback to the index() method
            } elseif (count($route) == 1) {
                $route[] = $this->defaultAction;
            }

            list($controller, $method) = $route;

            $controller = $this->namespace.'\\'.$controller;

            if (!class_exists($controller)) {
                throw new \Exception("Controller does not exist: $controller");
            }

            $controllerObj = new $controller();

            // give the controller access to the DI container
            if (method_exists($controllerObj, 'setApp')) {
                $controllerObj->setApp($this->app);
            }

            // collect any preset route parameters
            if (isset($route[2])) {
                $params = $route[2];
                $req->setParams($params);
            }

            $result = $controllerObj->$method($req, $res, $args);
        } elseif (is_callable($route)) {
            $result = call_user_func($route, $req, $res, $args);
        }

        if ($result instanceof View) {
            $res->render($result);
        }

        return $res;
    }