| 22 | void AbstractProtocolHandler::AddProcedure(const Procedure &procedure) { this->procedures[procedure.GetProcedureName()] = procedure; } |
| 23 | |
| 24 | void AbstractProtocolHandler::HandleRequest(const std::string &request, std::string &retValue) { |
| 25 | Json::Value req; |
| 26 | Json::Value resp; |
| 27 | Json::StreamWriterBuilder wbuilder; |
| 28 | wbuilder["indentation"] = ""; |
| 29 | |
| 30 | try { |
| 31 | istringstream(request) >> req; |
| 32 | this->HandleJsonRequest(req, resp); |
| 33 | } catch (const Json::Exception &e) { |
| 34 | this->WrapError(Json::nullValue, Errors::ERROR_RPC_JSON_PARSE_ERROR, Errors::GetErrorMessage(Errors::ERROR_RPC_JSON_PARSE_ERROR), resp); |
| 35 | } |
| 36 | |
| 37 | if (resp != Json::nullValue) |
| 38 | retValue = Json::writeString(wbuilder, resp); |
| 39 | } |
| 40 | |
| 41 | void AbstractProtocolHandler::ProcessRequest(const Json::Value &request, Json::Value &response) { |
| 42 | Procedure &method = this->procedures[request[KEY_REQUEST_METHODNAME].asString()]; |
nothing calls this directly
no test coverage detected