Beispiel #1
0
 /**
  * 初始化ServiceJob
  */
 public function init()
 {
     Dispatcher::getInstance()->disableView();
     if (strtolower($this->getRequest()->getMethod()) !== 'cli') {
         $sender = new SenderHttp();
         $sender->setStatus(503);
         $sender->send();
     }
 }
Beispiel #2
0
 /**
  * 设置标准响应http状态码
  *
  * @access protected
  * @param int $code 返回的http状态码
  * @return void
  */
 protected function sendHttpCode($code = 200)
 {
     $sender = new SenderHttp();
     if ($extra_headers = Console::serializeHeaders()) {
         $sender->getHeaders()->addHeaderLine('HTTP-CCS-FIREPHP', $extra_headers);
     }
     $sender->setStatus($code);
     $sender->send();
 }
Beispiel #3
0
                    $error->errorLog();
                }
                $error = explode(ES, $e->getMessage(), 2);
                if (isset($error[1])) {
                    return $error[1];
                }
            }
        }
    }
    $server = new Yar_Server(new Service());
    $server->handle();
} else {
    try {
        $app = new Application(INI_PATH, 'product');
        $app->bootstrap()->run();
    } catch (Exception $e) {
        $sender = new SenderHttp();
        if (Application::app()->getConfig()->application->debug) {
            $sender->setStatus(503, 'Exception: ' . $e->getMessage());
        } else {
            $sender->setStatus(503, 'Exception');
        }
        $sender->send();
        if (Application::app()->getConfig()->application->queue->log->switch) {
            $error = new ErrorLog($e, Dispatcher::getInstance()->getRequest());
            $error->errorLog();
        } else {
            echo $e->getMessage();
        }
    }
}