MCPcopy Create free account
hub / github.com/apache/brpc / default_method

Method default_method

example/http_c++/http_server.cpp:111–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

bthread_start_backgroundFunction · 0.85
releaseMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected