Re-bin edited a comment on issue #896: 有个疑惑,想知道brpc中的controller里面的uri数据一般是怎么获得的?
URL: https://github.com/apache/incubator-brpc/issues/896#issuecomment-522983524
 
 
   > 
https://github.com/apache/incubator-brpc/blob/8c32109de6d697f4c14bf808e19f251fb3a47e9d/src/brpc/details/http_message.cpp#L164
   
   
多谢大佬,还向问一下这个实例,里面的controller也能获得uri数据,也是通过上述的办法嘛?对这个地方有一些疑惑,还望不吝赐教。(代码源于Baidu开源的AnyQ)
 不知道为什么代码放上来没法全进那个框....
   
   
   `void HttpServiceImpl::anyq(google::protobuf::RpcController* cntl_base,
                  const HttpRequest* request,
                  HttpResponse*,
                  google::protobuf::Closure* done) {
       brpc::ClosureGuard done_guard(done);
       brpc::Controller* cntl = static_cast<brpc::Controller*>(cntl_base);
       cntl->http_response().set_content_type("application/json;charset=utf8");
   
       // preprocess
       Json::Value parameters;
       if (this->normalize_input(cntl, parameters) != 0
           || parameters.type() != Json::objectValue) {
           FATAL_LOG("normalize input failed!");
           return;
       }
   
       std::string str_anyq_input;
       if (_preproc_plugin->process(cntl, parameters, str_anyq_input) != 0) {
           FATAL_LOG("make anyq input failed!");
           return;
       }`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org

Reply via email to