public function handleRequest($requestedUrl) {
        $controllersToScan = self::$config["scanneableControllers"];
        $request = HttpRequestBuilder::buildFromRequestUrl($requestedUrl);

        /* check mode */
        if ($this->getMode() != self::$MODE_TESTING) {

            /* session start when not testing */
            Session::start();

            /* lang config */
            if (!is_null($request->getLang())) {
                Session::set("lang", $request->getLang());
            } else {
                if (is_null(Session::get("lang")) && !is_null(self::get("lang", "default"))) {
                    Session::set("lang", self::get("lang", "default"));
                }
            }
        }

        // scan controller
        $enabledController = FALSE;
        foreach ($controllersToScan as $appName => $controllerNamespace) {
            $class = $controllerNamespace . $request->getControllerClass();
            if ($this->validClass($class)) {
                $enabledController = TRUE;
                break;
            }
        }

        if ($enabledController) {
            $controller = new $class();
            $controller->setName($request->getControllerName());
        } else {

            $class = self::get("defaultController");
            $request->setAction(self::get("defaultMethod"));
            $controller = new $class();
        }

        /* controller security */
        if ($controller->isSecure()) {

            /* check authenticated */
            if (is_null(Session::get("user"))) {

                /* route to login screen */
                $request = new HttpRequest("");
                $request->setAction(self::get("loginMethod"));
                $class = self::get("loginController");
                $controller = new $class();
            } else {

                /* check permissions */
                if (!$controller->canAccess(Session::get("user"))) {
                    $request = new HttpRequest("");
                    $request->setAction(self::get("restrictedMethod"));
                    $request->setControllerName("user");
                    $class = self::get("defaultController");
                    $controller = new $class();
                }
            }
        }
        $method = $request->getAction();
        $this->dispatch($controller, $method, $request);
    }