static function run()
 {
     if (empty($_SERVER['HTTP_HOST'])) {
         die("\\o/\n");
     }
     $method = $_SERVER['REQUEST_METHOD'];
     $path = '';
     if (isset($_SERVER['PATH_INFO'])) {
         $path = $_SERVER['PATH_INFO'];
     }
     $ret = self::find_route(array('method' => $method, 'path' => $path));
     if ($ret === FALSE) {
         @header('HTTP/1.0 404 Not Found');
         die('<h1>404 - Introuvable.</h1>' . "\n");
     }
     if (self::_handle_json_encoded_data() === FALSE) {
         self::_handle_put_data();
     }
     self::_init_params();
     self::$action_params = array_merge(self::$action_params, $ret['extra_params']);
     $route = $ret['route'];
     $action = $ret['action'];
     $response_format = $ret['response_format'];
     $controller = $route['controller'];
     $controller_file = self::$controllers_path . preg_replace('/[^a-z0-9-]/i', '_', $controller) . self::$controller_suffix;
     if (file_exists($controller_file) === FALSE) {
         @header('HTTP/1.0 503 Service Unavailable');
         die('<h1>503 - Nonexistent controller.</h1>' . "\n");
     }
     require_once $controller_file;
     if (is_callable(array('Controller', $action)) === FALSE) {
         @header('HTTP/1.0 501 Not implemented');
         die('<h1>501 - Nonexistent action.</h1>' . "\n");
     }
     $ret = TRUE;
     try {
         $ret = call_user_func(array('Controller', $action), self::params('id'));
     } catch (Exception $e) {
         throw $e;
     }
     if ($ret === FALSE) {
         @header('HTTP/1.0 500 Internal Server Error');
         die('<h1>500 - Action sent a generic error</h1>' . "\n");
     }
     if (is_string($ret)) {
         if (ENABLE_FRAGMENTS_CACHING) {
             $known_fragments = (string) params('_fragments');
             $ret = FragmentCache::crunch($ret, $known_fragments);
         }
         echo $ret;
         return TRUE;
     }
     if (!is_array($ret)) {
         @header('HTTP/1.0 500 Internal Server Error');
         die('<h1>500 - Invalid response type</h1>' . "\n");
     }
     switch (strtolower($response_format)) {
         case 'json':
             self::_output('application/json', json_encode($ret));
             return TRUE;
         case 'jsonp':
             $jsonp_cb = (string) params('jsonp');
             if (strstr($jsonp_cb, JSONP_CB_REQUIRED_SUBSTR) === FALSE || preg_match('/^[a-z_]+[a-z0-9_.]*$/i', $jsonp_cb) <= 0) {
                 header('HTTP/1.0 400 Bad Request');
                 echo '<h1>400 - Invalid JSON-P callback name</h1>';
                 die;
             }
             $ret = json_encode($ret);
             # Unicode chars 0x2028 and 0x2029 are valid JSON but not valid JS
             # They need to be encoded as \uABCD for JSON-P.
             $ret = str_replace("
", '\\u2028', $ret);
             $ret = str_replace("
", '\\u2029', $ret);
             self::_output('text/javascript', $jsonp_cb . '(' . $ret . ');');
             return TRUE;
         case 'html':
             if (empty($_SERVER['PROD'])) {
                 self::_output('text/plain', htmlentities(serialize($ret)));
                 return TRUE;
             }
             break;
         case 'igb':
             if (function_exists('igbinary_serialize')) {
                 self::_output('application/igbinary-serialized', igbinary_serialize($ret));
                 return TRUE;
             }
             break;
         case 'phpser':
             self::_output('application/php-serialized', serialize($ret));
             return TRUE;
     }
     header('HTTP/1.0 500 Internal Server Error');
     header('Content-Type: text/html; charset=UTF-8');
     echo '<h1>500 - Unknown output format (' . htmlentities($response_format) . ').</h1>' . "\n";
     die(htmlentities('[' . $_SERVER['REQUEST_METHOD'] . '] [' . $_SERVER['HTTP_HOST'] . '] [' . $_SERVER['REQUEST_URI'] . ']') . "\n");
     /* NOTREACHED */
     return FALSE;
 }