public static function route()
    {
        $startTime = TimeUtils::getTimestamp();
        
        set_exception_handler('Xentriq\Core\Xentriq::exceptionHandler');
        set_error_handler('Xentriq\Core\Xentriq::errorHandler', (E_ERROR | E_RECOVERABLE_ERROR | E_NOTICE));
        
        self::ensureDefines();
        
        if (!DISABLE_DEFAULT_RESPONSE_HEADERS) {
            header("X-Frame-Options: SAMEORIGIN"); // DENY, SAMEORIGIN, ALLOW-FROM <uri>
            header("X-XSS-Protection: 1; mode=block");
            header("X-Content-Type-Options: nosniff"); // prevents content-type sniffing
        }
        
        $displayErrors = 0;
        if (DEBUG) {
            header_remove("cache-control");
            header_remove("pragma");
            header_remove("expires");
            
            error_reporting(E_ALL);
            $displayErrors = 1;
        }
        
        ini_set("display_errors", $displayErrors);
        
        self::setActiveContentDirectory(DIR_CONTENT);
        
        // ensure we have a session
        Session::ensureSession();
        
        foreach (Addons::getRequestFilters() as $filter) {
            if (!$filter->filter()) {
                exit(0);
            }
        }
        
        // pre-processing hook
        Addons::invokeHook('xentriq.bootstrap.route');
        
        // perform an action if the 'do' parameter has been set.
        if (Request::hasInputValue("do", false, true)) {
            self::routeAction();
            exit(0);
        }
        
        register_shutdown_function('Xentriq\Core\Xentriq::shutdown');
        
        // output requested content
        Output::outputRequested(self::getActiveContentDirectory());
        
        if (DEBUG && Output::getLastRenderDuration() > 0) {
            $duration = TimeUtils::getDuration($startTime);
            
            if (!Request::hasServerVariable('HTTP_X_REQUESTED_WITH')) {
                echo CHAR_CRLF . '<!-- Xentriq Stats [total=' . $duration . 's, parsing=' . Output::getLastParseDuration() . 's, rendering=' . Output::getLastRenderDuration() . 's, execution=' . Output::getLastExecutionDuration() . 's] -->';
            }
        }
        
        exit(0);
    }