yellowkitee opened a new issue, #2854:
URL: https://github.com/apache/brpc/issues/2854

       void Echo(google::protobuf::RpcController* cntl_base,
                 const HttpRequest*,
                 HttpResponse*,
                 google::protobuf::Closure* done) {
           // This object helps you to call done->Run() in RAII style. If you 
need
           // to process the request asynchronously, pass done_guard.release().
           brpc::ClosureGuard done_guard(done);
   
           brpc::Controller* cntl =
               static_cast<brpc::Controller*>(cntl_base);
   
           // optional: set a callback function which is called after response 
is sent
           // and before cntl/req/res is destructed.
           
**cntl->set_after_rpc_resp_fn(std::bind(&HttpServiceImpl::CallAfterRpc,**
               std::placeholders::_1, std::placeholders::_2, 
std::placeholders::_3));
   
           // Fill response.
           cntl->http_response().set_content_type("text/plain");
           butil::IOBufBuilder os;
           os << "queries:";
           for (brpc::URI::QueryIterator it = 
cntl->http_request().uri().QueryBegin();
                   it != cntl->http_request().uri().QueryEnd(); ++it) {
               os << ' ' << it->first << '=' << it->second;
           }
           os << "\nbody: " << cntl->request_attachment() << '\n';
           os.move_to(cntl->response_attachment());
       }


-- 
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.

To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to