/**
  * @Override 
  */
 public function render()
 {
     $file = Atto::makeAccessPath(array(Atto::dir_error(), Atto::dir_atto_error()), array($this->status, 'etc'), array('.html', '.php'));
     $this->error_message = $this->getMessage();
     $this->title = $this->status . '  ' . AttoHttpHelper::getTextByResponseCode($this->status);
     AttoHttpHelper::setResponseCode($this->status);
     include $file;
 }
 /**
  * dispatch
  *
  * @method dispatch
  */
 public function dispatch()
 {
     $pathinfo_blocks = explode('/', ltrim(Atto::uri(), '\\'));
     $i = count($pathinfo_blocks) - 1;
     if ($pathinfo_blocks[$i] === '') {
         $file_names = array('index.html', 'index.php');
     } else {
         $file_names = array($pathinfo_blocks[$i]);
         $pathinfo_blocks[$i] = '';
     }
     $request_dir = implode(DS, $pathinfo_blocks);
     $hook_file = Atto::makeAccessPath(Atto::dir_hook() . $request_dir, $file_names, array('', '.php'));
     $htdocs_file = Atto::makeAccessPath(Atto::dir_htdocs() . $request_dir, $file_names);
     $huck_file = Atto::makeAccessPath(Atto::dir_huck() . $request_dir, $file_names, array('', '.php'));
     $view_file = null;
     if ($hook_file === '' && $htdocs_file === '' && $huck_file === '') {
         // not found
         $view_file = Atto::makeAccessPath(array(Atto::dir_error(), Atto::dir_atto_error()), array(404, 'etc'), array('.html', '.php'));
         $this->title = '404  ' . AttoHttpHelper::getTextByResponseCode(404);
         $this->error_message = '';
         AttoHttpHelper::setResponseCode(404);
         $this->funcs->view = array($this, '___view___');
     } else {
         if ($htdocs_file !== '' && is_dir($htdocs_file)) {
             // access to the directory
             $redirect_URIs = explode('?', Atto::requestUrl());
             $redirect_URIs[0] .= '/';
             AttoHttpHelper::redirect(implode('?', $redirect_URIs), 301);
         }
         if ($htdocs_file && is_file($htdocs_file)) {
             $this->files->view = $htdocs_file;
         }
         if ($hook_file && is_file($hook_file)) {
             $this->files->hook = $hook_file;
         }
         if ($huck_file && is_file($huck_file)) {
             $this->files->huck = $huck_file;
         }
     }
     $this->before();
     $this->hook();
     $content = $this->view();
     $this->render($content);
     $this->huck();
     $this->after();
 }