| 109 | } |
| 110 | |
| 111 | void default_method(google::protobuf::RpcController* cntl_base, |
| 112 | const HttpRequest*, |
| 113 | HttpResponse*, |
| 114 | google::protobuf::Closure* done) { |
| 115 | brpc::ClosureGuard done_guard(done); |
| 116 | brpc::Controller* cntl = |
| 117 | static_cast<brpc::Controller*>(cntl_base); |
| 118 | const std::string& filename = cntl->http_request().unresolved_path(); |
| 119 | if (filename == "largefile") { |
| 120 | // Send the "largefile" with ProgressiveAttachment. |
| 121 | std::unique_ptr<Args> args(new Args); |
| 122 | args->pa = cntl->CreateProgressiveAttachment(); |
| 123 | bthread_t th; |
| 124 | bthread_start_background(&th, NULL, SendLargeFile, args.release()); |
| 125 | } else { |
| 126 | cntl->response_attachment().append("Getting file: "); |
| 127 | cntl->response_attachment().append(filename); |
| 128 | } |
| 129 | } |
| 130 | }; |
| 131 | |
| 132 | // Restful service. (The service implementation is exactly same with regular |
nothing calls this directly
no test coverage detected