• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ WebContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中WebContext的典型用法代码示例。如果您正苦于以下问题:C++ WebContext类的具体用法?C++ WebContext怎么用?C++ WebContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: strstr

	void GetFeatureRequest::SetTypeName(const char* value,bool encoding)
	{
		//if(value==NULL)
		//{
		//	return;
		//}
		//const char* sep = strstr(value,":");
		//m_full_name = value;
		//m_type_name = sep==NULL ? value : sep+1;

		if(value==NULL)
		{
			m_type_name.clear();
		}
		else
		{
			const char* sep = strstr(value,":");			
			const char* typeName = (sep==NULL ? value : sep+1);

			//m_full_name = value;
			//m_type_name = typeName;
			if(encoding)
			{
				WebContext* pWebContext = augeGetWebContextInstance();
				m_full_name = pWebContext->ParameterEncoding(value);
				m_type_name = pWebContext->ParameterEncoding(typeName);
			}
			else
			{
				m_full_name = value;
				m_type_name = typeName;
			}
			
		}
	}
开发者ID:marsprj,项目名称:Auge.GIS,代码行数:35,代码来源:GetFeatureRequest.cpp


示例2: augeGetWebContextInstance

	bool GetFeatureRequest::Create(rude::CGI& cgi, Map* pMap)
	{
		WebContext* pWebContext = augeGetWebContextInstance();
		char parameter[AUGE_NAME_MAX];

		SetVersion(cgi["version"]);

		//auge_web_parameter_encoding(, parameter, AUGE_NAME_MAX, pWebContext->IsIE());
		SetTypeName(cgi["typeName"],true);
		
		auge_web_parameter_encoding(cgi["sourceName"], parameter, AUGE_NAME_MAX, pWebContext->IsIE());
		SetSourceName(parameter);

		//auge_web_parameter_encoding(cgi["mapName"], parameter, AUGE_NAME_MAX, pWebContext->IsIE());
		SetMapName(cgi["mapName"], true);

		SetOutputFormat(cgi["outputFormat"]);
		SetMaxFeatures(cgi["maxFeatures"]);
		SetOffset(cgi["offset"]);
		SetBBox(cgi["bbox"]);

		SetEncoding(cgi["encoding"]);

		m_filter = cgi["filter"];
		m_fields = cgi["fields"];
		//if(!m_extent.IsValid())
		//{
		//	SetQuery(cgi["filter"],cgi["fields"], GetTypeName(), pMap);
		//}

		return true;
	}
开发者ID:marsprj,项目名称:Auge.GIS,代码行数:32,代码来源:GetFeatureRequest.cpp


示例3: openSession

SessionPtr SessionManager::openSession(WebContext &ctx, const string &_id) {
  string id = _id;
  if (id.empty()) id = generateSessionID(ctx);

  SmartLock lock(this);

  // Get the session
  SessionPtr session;
  sessions_t::iterator it = sessions.find(id);
  if (it != sessions.end()) session = it->second;

  if (session.isNull()) {
    session = factory->createSession(id);
    sessions.insert(sessions_t::value_type(id, session));
  }

  // Set IP
  IPAddress ip = ctx.getClientIP();
  ip.setPort(0);
  session->setIP(ip);

  session->touch(); // Update timestamp
  ctx.setSession(session);
  dirty = true;

  return session;
}
开发者ID:kbernhagen,项目名称:cbang,代码行数:27,代码来源:SessionManager.cpp


示例4: augeGetCartoFactoryInstance

	WebResponse* GetPreviewHandler::DrawFeature(FeatureClass* pFeatureClass, GetPreviewRequest* pRequest)
	{
		g_uint width  = pRequest->GetWidth();
		g_uint height = pRequest->GetHeight();

		Canvas* pCanvas = NULL;
		CartoFactory* pCartoFactory = augeGetCartoFactoryInstance();
		GLogger* pLogger = augeGetLoggerInstance();

		Style* pStyle = NULL;
		FeatureLayer* pFeatureLayer = NULL;
		CartoManager* pCartoManager = augeGetCartoManagerInstance();
		StyleFactory* pStyleFactory = augeGetStyleFactoryInstance();

		pFeatureLayer = pCartoFactory->CreateFeatureLayer();
		pFeatureLayer->SetFeatureClass(pFeatureClass);
		//pFeatureClass->AddRef();

		GField* pField = pFeatureClass->GetFields()->GetGeometryField();
		augeGeometryType type = pField->GetGeometryDef()->GeometryType();
		pStyle = pStyleFactory->CreateFeatureStyle(type);

		GColor bgColor(255,255,255,255);
		pCanvas = pCartoFactory->CreateCanvas2D(width, height);
		pCanvas->DrawBackground(bgColor);

		GEnvelope extent = pRequest->GetExtent();
		if(extent.IsValid())
		{
			pCanvas->SetViewer(extent);
		}
		else
		{
			pCanvas->SetViewer(pFeatureClass->GetExtent());
		}
		//pCanvas->SetViewer(extent.IsValid() ? extent : pFeatureClass->GetExtent());
		
		pCanvas->DrawLayer(pFeatureLayer, pStyle);

		char img_sfix[AUGE_EXT_MAX] = {0};
		//char img_name[AUGE_NAME_MAX] = {0};
		char img_path[AUGE_PATH_MAX] = {0};
		auge_get_image_suffix(pRequest->GetMimeType(), img_sfix, AUGE_EXT_MAX);
		//auge_generate_uuid(img_name, AUGE_NAME_MAX);
		WebContext* pWebContext = augeGetWebContextInstance();
		//const char* cache_path = "E:\\Research\\Auge.GIS\\Dist\\32_x86_win_vc10\\binD\\cache\\map";//pWebContext->GetCacheMapPath();
		const char* uuid = pFeatureClass->GetUUID();
		auge_make_path(img_path, NULL, pWebContext->GetCacheMapPath(), pFeatureClass->GetUUID(), img_sfix);
		pCanvas->Save(img_path);
		pCanvas->Release();
		GetPreviewResponse* pMapResponse = new GetPreviewResponse(pRequest);
		pMapResponse->SetPath(img_path);

		pStyle->Release();
		pFeatureLayer->Release();

		return pMapResponse;
	}
开发者ID:marsprj,项目名称:Auge.GIS,代码行数:58,代码来源:GetPreviewHandler.cpp


示例5: setSessionCookie

void SessionManager::setSessionCookie(WebContext &ctx) const {
  SessionPtr session = ctx.getSession();

  Cookie cookie(sessionCookie, session->getID(), "", "",
                session->getCreationTime() + sessionLifetime,
                sessionLifetime, true, true);

  ctx.getResponse().set("Set-Cookie", cookie.toString());
}
开发者ID:kbernhagen,项目名称:cbang,代码行数:9,代码来源:SessionManager.cpp


示例6: augeGetWebContextInstance

	bool CreateMapRequest::Create(rude::CGI& cgi)
	{
		char str[AUGE_NAME_MAX];
		WebContext* pWebContext = augeGetWebContextInstance();

		auge_web_parameter_encoding(cgi["name"], str, AUGE_NAME_MAX, pWebContext->IsIE());
		SetName(str);
		SetExtent(cgi["extent"]);
		SetSRID(cgi["srid"]);
		SetVersion(cgi["version"]);
		return true;
	}
开发者ID:marsprj,项目名称:Auge.GIS,代码行数:12,代码来源:CreateMapRequest.cpp


示例7: augeGetWebContextInstance

	void DescribeLayerRequest::SetLayerName(const char* name)
	{
		if(name==NULL)
		{
			m_layer_name.clear();
		}
		else
		{
			WebContext* pWebContext = augeGetWebContextInstance();
			m_layer_name = pWebContext->ParameterEncoding(name);
			//m_layer_name = name;
		}

	}
开发者ID:marsprj,项目名称:Auge.GIS,代码行数:14,代码来源:DescribeLayerRequest.cpp


示例8: generateSessionID

string SessionManager::generateSessionID(WebContext &ctx) const {
#ifdef HAVE_OPENSSL
  Digest digest("md5");

  if (ctx.getRequest().has("User-Agent"))
    digest.update(ctx.getRequest().get("User-Agent"));
  digest.updateWith(Time::now());

  return digest.toHexString();
#else

  return SSTR("0x" << hex << Random::instance().rand<uint64_t>());
#endif
}
开发者ID:kbernhagen,项目名称:cbang,代码行数:14,代码来源:SessionManager.cpp


示例9: handlePage

bool WebHandler::handlePage(WebContext &ctx, ostream &stream, const URI &uri) {
  if (WebPageHandlerGroup::handlePage(ctx, stream, uri)) {
    // Tell client to cache static pages
    if (ctx.isStatic()) ctx.getConnection().getResponse().setCacheExpire();

    // Set default content type
    Response &response = ctx.getConnection().getResponse();
    if (!response.has("Content-Type"))
      response.setContentTypeFromExtension(uri.getPath());

    return true;
  }

  return false;
}
开发者ID:kbernhagen,项目名称:cbang,代码行数:15,代码来源:WebHandler.cpp


示例10: augeGetJobManagerInstance

	void FeatureProjectHandler::Begin(User* pUser)
	{
		JobManager* pJobmanager = augeGetJobManagerInstance();
		WebContext* pWebContext = augeGetWebContextInstance();
		
		if(m_pJob!=NULL)
		{
			AUGE_SAFE_RELEASE(m_pJob);
		}
		const char* client = "";
		const char* server = pWebContext->GetServer();
		const char* operation= GetName();
		const char* service = "gps";
		const char* params = "";
		m_pJob = pJobmanager->AddJob(pUser->GetID(), service, operation, params, client, server);
	}
开发者ID:marsprj,项目名称:Auge.GIS,代码行数:16,代码来源:FeatureProjectHandler.cpp


示例11: readJson

void RestResource::readJson(WebContext &wc, Json::Value & value) {
    Json::Reader reader;
    bool success = reader.parse(wc.getRequest().getContent(), value);
    if(!success) {
        throw ParsingContentException();
    }

}
开发者ID:AndresOtero,项目名称:Tinder-Server,代码行数:8,代码来源:RestResource.cpp


示例12: writeJsonResponse

void RestResource::writeJsonResponse(WebContext &wc, Json::Value &value, int apiStatus) {
    Json::Value response;
    response[API_RESPONSE_PARAM] = value;
    response[API_STATUS_CODE_PARAM] = apiStatus;
    Json::FastWriter writer;
    string content = writer.write(response);
    wc.getResponse().setContent(content);
}
开发者ID:AndresOtero,项目名称:Tinder-Server,代码行数:8,代码来源:RestResource.cpp


示例13: if

	void DescribeServiceRequest::SetName(const char* name)
	{
		if(name==NULL)
		{
			m_name.clear();
		}
		else if(strlen(name)==0)
		{
			m_name.clear();
		}
		else
		{
			WebContext* pWebContext = augeGetWebContextInstance();
			m_name = pWebContext->ParameterEncoding(name);
		}
		
	}
开发者ID:marsprj,项目名称:Auge.GIS,代码行数:17,代码来源:DescribeServiceRequest.cpp


示例14: getSession

SessionPtr SessionManager::getSession(WebContext &ctx,
                                      const std::string &_id) const {
  string id = _id;
  if (id.empty()) id = ctx.getRequest().findCookie(sessionCookie);
  if (id.empty()) THROW("Session ID is not set");

  if (!ctx.getSession().isNull() && id == ctx.getSession()->getID())
    return ctx.getSession();

  SmartLock lock(this);

  iterator it = sessions.find(id);
  if (it == end()) THROWS("Session ID '" << id << "' does not exist");
  SmartPointer<Session> session = it->second;

  // Check that IP address matches
  if (ctx.getClientIP().getIP() != session->getIP().getIP())
    THROWS("Session ID (" << id << ") IP address changed from "
           << ctx.getClientIP() << " to " << session->getIP());

  session->touch(); // Update timestamp
  ctx.setSession(session);
  dirty = true;

  return session;
}
开发者ID:kbernhagen,项目名称:cbang,代码行数:26,代码来源:SessionManager.cpp


示例15: if

	void RemoveTileStoreRequest::SetStoreName(const char* name)
	{
		if(name==NULL||(strlen(name)==0))
		{
			m_store_name.clear();
		}
		else if(strlen(name)==0)
		{
			m_store_name.clear();
		}
		else
		{
			//m_store_name = name;
			WebContext* pWebContext = augeGetWebContextInstance();
			m_store_name = pWebContext->ParameterEncoding(name);
		}

	}
开发者ID:marsprj,项目名称:Auge.GIS,代码行数:18,代码来源:RemoveTileStoreRequest.cpp


示例16: closeSession

void SessionManager::closeSession(WebContext &ctx, const string &_id) {
  string id = _id;
  if (id.empty()) id = ctx.getRequest().findCookie(sessionCookie);
  if (id.empty()) return;

  SmartLock lock(this);
  sessions.erase(id);
  dirty = true;
}
开发者ID:kbernhagen,项目名称:cbang,代码行数:9,代码来源:SessionManager.cpp


示例17: augeGetWebContextInstance

	void GetCountRequest::SetTypeName(const char* value, bool encoding)
	{
		if(value==NULL)
		{
			return;
		}
		WebContext* pWebContext = augeGetWebContextInstance();
		const char* sep = strstr(value,":");
		if(encoding)
		{
			m_full_name = pWebContext->ParameterEncoding(value);
			m_type_name = pWebContext->ParameterEncoding(sep==NULL ? value : sep+1);
		}
		else
		{
			m_full_name = value;
			m_type_name = sep==NULL ? value : sep+1;
		}
	}
开发者ID:marsprj,项目名称:Auge.GIS,代码行数:19,代码来源:GetCountRequest.cpp


示例18: getLikes

void LikeResource::getLikes(WebContext &wc) {
	User *user;
	try {
		user = profileServices.getUserByID(wc.getUserid());
		std::list<User *> likes = this->matchServices.getLikesForUser(user);
		Json::Value result;
		result["likes"] = Json::Value(Json::arrayValue);
		for (auto it = likes.begin(); it != likes.end(); ++it) {
			result["likes"].append((*it)->toJson());
			delete (*it);
		}
		delete user;
		this->writeJsonResponse(wc, result);
	} catch (UserNotFoundException & e) {
		Json::Value result;
		this->writeJsonResponse(wc, result, API_STATUS_CODE_AUTH_PROFILE_CREATION_REQUIRED);
	} catch (ServiceException &e) {
		wc.getResponse().setStatus(STATUS_500_INTERNAL_SERVER_ERROR);
	}
}
开发者ID:AndresOtero,项目名称:Tinder-Server,代码行数:20,代码来源:LikeResource.cpp


示例19: buildResponse

void WebHandler::buildResponse(HTTP::Context *_ctx) {
  if (!initialized) THROW("Not initialized");

  WebContext *ctx = dynamic_cast<WebContext *>(_ctx);
  if (!ctx) THROW("Expected WebContext");

  Connection &con = ctx->getConnection();

  // Check request method
  Request &request = con.getRequest();
  switch (request.getMethod()) {
    case RequestMethod::HTTP_GET:
    case RequestMethod::HTTP_POST:
      break;
  default: return; // We only handle GET and POST
  }

  try {
    if (!allow(*ctx)) errorPage(*ctx, StatusCode::HTTP_UNAUTHORIZED);
    else {
      URI uri = con.getRequest().getURI();
      const string &path = uri.getPath();
      if (path[path.length() - 1] == '/') uri.setPath(path + "index.html");

      // TODO sanitize path

      if (!handlePage(*ctx, con, uri))
        errorPage(*ctx, StatusCode::HTTP_NOT_FOUND);
    }

  } catch (const Exception &e) {
    StatusCode code = StatusCode::HTTP_INTERNAL_SERVER_ERROR;
    if (0 < e.getCode()) code = (StatusCode::enum_t)e.getCode();

    errorPage(*ctx, code, e.getMessage());

    LOG_ERROR(code << ": " << e);
  }

  con << flush;
}
开发者ID:kbernhagen,项目名称:cbang,代码行数:41,代码来源:WebHandler.cpp


示例20: likeUser

void LikeResource::likeUser(WebContext &wc) {
	User *user;
	try {
		user = profileServices.getUserByID(wc.getUserid());
	} catch (UserNotFoundException & e) {
		wc.getResponse().setStatus(STATUS_400_BAD_REQUEST);
	} catch (ServiceException &e) {
		wc.getResponse().setStatus(STATUS_500_INTERNAL_SERVER_ERROR);
	}
	User* liked;
	try {
		Json::Value json;
		RestResource::readJson(wc, json);
		string likedId = json.get("likedUser", "EMPTY FIELD").asString();
		liked = this->profileServices.getUserByID(likedId);
		this->matchServices.likeAUser(user, liked);
		delete liked;
		delete user;
		this->writeJsonResponse(wc);
	} catch (UserNotFoundException & e) {
		delete user;
		wc.getResponse().setStatus(STATUS_400_BAD_REQUEST);
	}
}
开发者ID:AndresOtero,项目名称:Tinder-Server,代码行数:24,代码来源:LikeResource.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ WebCookieJar类代码示例发布时间:2022-05-31
下一篇:
C++ WebCompositorSupport类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap