Prado\Web\Services\TRpcService::run PHP Метод

run() публичный Метод

Runs the service
public run ( )
    public function run()
    {
        $_request = $this->getRequest();
        if (($_providerId = $_request->getServiceParameter()) == "") {
            throw new THttpException(400, 'RPC API-Provider id required');
        }
        if (($_method = $_request->getRequestType()) != 'POST') {
            throw new THttpException(405, 'Invalid request method "' . $_method . '"!');
        }
        // TODO Exception muss "Allow POST" Header setzen
        if (($_mimeType = $_request->getContentType()) === null) {
            throw new THttpException(406, 'Content-Type is missing!');
        }
        // TODO Exception muss gültige Content-Type werte zurück geben
        if (!in_array($_mimeType, array_keys($this->protocolHandlers))) {
            throw new THttpException(406, 'Unsupported Content-Type!');
        }
        // TODO see previous
        $_protocolHandlerClass = $this->protocolHandlers[$_mimeType];
        $_protocolHandler = new $_protocolHandlerClass();
        if (($_result = $this->createApiProvider($_protocolHandler, $_providerId)->processRequest()) !== null) {
            $_response = $this->getResponse();
            $_protocolHandler->createResponseHeaders($_response);
            $_response->write($_result);
        }
    }