当前位置: 首页>>代码示例>>C++>>正文


C++ Director::findBackend方法代码示例

本文整理汇总了C++中Director::findBackend方法的典型用法代码示例。如果您正苦于以下问题:C++ Director::findBackend方法的具体用法?C++ Director::findBackend怎么用?C++ Director::findBackend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Director的用法示例。


在下文中一共展示了Director::findBackend方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: processBackend

// }}}
// {{{ backends
bool ApiRequest::processBackend()
{
	Director* director = findDirector(tokens_[0]);
	if (!director) {
		request_->status = x0::HttpStatus::NotFound;
		request_->finish();
		return true;
	}

	switch (requestMethod()) {
		case HttpMethod::GET:
			return show(director->findBackend(tokens_[2].str()));
		case HttpMethod::POST:
			return update(director->findBackend(tokens_[2].str()), director);
		case HttpMethod::UNLOCK:
			return lock(false, director->findBackend(tokens_[2].str()), director);
		case HttpMethod::LOCK:
			return lock(true, director->findBackend(tokens_[2].str()), director);
		case HttpMethod::DELETE:
			return destroy(director->findBackend(tokens_[2].str()), director);
		default:
			return false;
	}
}
开发者ID:hiwang123,项目名称:x0,代码行数:26,代码来源:ApiRequest.cpp

示例2: pass

void DirectorPlugin::pass(HttpRequest* r, const std::string& directorName,
                          const std::string& backendName) {
    auto i = directors_.find(directorName);
    if (i == directors_.end()) {
        r->log(Severity::error,
               "director.pass(): No director with name '%s' configured.",
               directorName.c_str());
        internalServerError(r);
        return;
    }
    Director* director = i->second.get();

    // custom backend route
    Backend* backend = nullptr;
    if (!backendName.empty()) {
        backend = director->findBackend(backendName);

        if (!backend) {
            // explicit backend specified, but not found -> do not serve.
            r->log(Severity::error, "director: Requested backend '%s' not found.",
                   backendName.c_str());
            internalServerError(r);
            return;
        }
    }

#if !defined(NDEBUG)
    server().log(Severity::trace, "director: passing request to %s [backend %s].",
                 director->name().c_str(), backend->name().c_str());
#endif

    auto rn = requestNotes(r);
    rn->manager = director;

    r->onPostProcess.connect(std::bind(&DirectorPlugin::addVia, this, r));

    director->schedule(rn, backend);

    return;
}
开发者ID:tempbottle,项目名称:x0,代码行数:40,代码来源:DirectorPlugin.cpp


注:本文中的Director::findBackend方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。