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


C++ Cookie::getValue方法代码示例

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


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

示例1: assertTrue

TEST(CookieDecoderTest, testDecodingCommaSeparatedClientSideCookies) {
    String source =
        "$Version=\"1\"; session_id=\"1234\", " +
        "$Version=\"1\"; session_id=\"1111\"; $Domain=\".cracker.edu\"";

    Set<Cookie> cookies = CookieDecoder.decode(source);
    Iterator<Cookie> it = cookies.iterator();
    Cookie c;

    assertTrue(it.hasNext());
    c = it.next();
    assertEquals(1, c.getVersion());
    assertEquals("session_id", c.getName());
    assertEquals("1234", c.getValue());
    assertNull(c.getPath());
    assertNull(c.getComment());
    assertNull(c.getCommentUrl());
    assertNull(c.getDomain());
    assertTrue(c.getPorts().isEmpty());
    assertEquals(Long.MIN_VALUE, c.getMaxAge());

    assertTrue(it.hasNext());
    c = it.next();
    assertEquals(1, c.getVersion());
    assertEquals("session_id", c.getName());
    assertEquals("1111", c.getValue());
    assertEquals(".cracker.edu", c.getDomain());
    assertNull(c.getPath());
    assertNull(c.getComment());
    assertNull(c.getCommentUrl());
    assertTrue(c.getPorts().isEmpty());
    assertEquals(Long.MIN_VALUE, c.getMaxAge());

    assertFalse(it.hasNext());
}
开发者ID:1suming,项目名称:cetty2,代码行数:35,代码来源:CookieDecoderTest.cpp

示例2: assertEquals

TEST(CookieDecoderTest, testDecodingClientSideCookies) {
    String source = "$Version=\"1\"; " +
                    "Part_Number=\"Riding_Rocket_0023\"; $Path=\"/acme/ammo\"; " +
                    "Part_Number=\"Rocket_Launcher_0001\"; $Path=\"/acme\"";

    Set<Cookie> cookies = CookieDecoder.decode(source);
    Iterator<Cookie> it = cookies.iterator();
    Cookie c;

    c = it.next();
    assertEquals(1, c.getVersion());
    assertEquals("Part_Number", c.getName());
    assertEquals("Rocket_Launcher_0001", c.getValue());
    assertEquals("/acme", c.getPath());
    assertNull(c.getComment());
    assertNull(c.getCommentUrl());
    assertNull(c.getDomain());
    assertTrue(c.getPorts().isEmpty());
    assertEquals(Long.MIN_VALUE, c.getMaxAge());

    c = it.next();
    assertEquals(1, c.getVersion());
    assertEquals("Part_Number", c.getName());
    assertEquals("Riding_Rocket_0023", c.getValue());
    assertEquals("/acme/ammo", c.getPath());
    assertNull(c.getComment());
    assertNull(c.getCommentUrl());
    assertNull(c.getDomain());
    assertTrue(c.getPorts().isEmpty());
    assertEquals(Long.MIN_VALUE, c.getMaxAge());

    assertFalse(it.hasNext());
}
开发者ID:1suming,项目名称:cetty2,代码行数:33,代码来源:CookieDecoderTest.cpp

示例3: escapeCookies

string CookieList::escapeCookies() const
{
	string cookie_parameter("");
	bool first = true;
	auto it = cookie_list_.cbegin();
	while(it != cookie_list_.cend())
	{
		if(first == true)
		{
			first = false;
		}
		else
		{
			cookie_parameter += ";";
		}

		Cookie cookie = (*it);
		cookie_parameter += (cookie.getName() + "=" + cookie.getValue());

		++it;
	}
	return cookie_parameter;
}
开发者ID:bosturbo,项目名称:GooglePlusLibrary,代码行数:23,代码来源:CookieList.cpp

示例4: preCall

  void ScopeManager::preCall(HttpRequest& request, const std::string& app)
  {
    // check session-cookie
    std::string currentSessionCookieName = app.empty() ? std::string("tntnet") : "tntnet." + app;
    std::string currentSecureSessionCookieName = app.empty() ? std::string("stntnet") : "stntnet." + app;

    Cookie c = request.getCookie(currentSessionCookieName);
    if (c.getValue().empty())
    {
      /*
      cxxtools::MutexLock lock(sessionScopesMutex);
      log_debug(sessionScopes.size() << " sessions available");
      for (sessionscopes_type::iterator it = sessionScopes.begin(); it != sessionScopes.end(); ++it)
        log_debug("available session " << it->first << " value " << it->second);
        */

      log_debug("session cookie " << currentSessionCookieName << " not found - keep session");
    }
    else
    {
      log_debug("session cookie " << currentSessionCookieName << " found: " << c.getValue());

      cxxtools::MutexLock lock(sessionScopesMutex);

      Sessionscope* sessionScope;

      sessionscopes_type::iterator it = sessionScopes.find(c.getValue());
      if (it == sessionScopes.end())
      {
        log_debug("session not found - create new");
        sessionScope = new Sessionscope();
        sessionScope->addRef();
        sessionScopes.insert(sessionscopes_type::value_type(c.getValue(), sessionScope));
      }
      else
      {
        log_debug("session found");
        sessionScope = it->second;
        sessionScope->touch();
      }

      request.setSessionScope(sessionScope);
    }

    if (request.isSsl())
    {
      c = request.getCookie(currentSecureSessionCookieName);
      if (c.getValue().empty())
      {
        log_debug("secure session cookie " << currentSessionCookieName
            << " not found - keep session");
      }
      else if (request.isSsl())
      {
        log_debug("secure session cookie " << currentSessionCookieName
            << " found: " << c.getValue());

        cxxtools::MutexLock lock(sessionScopesMutex);

        Sessionscope* sessionScope;

        sessionscopes_type::iterator it = sessionScopes.find(c.getValue());
        if (it == sessionScopes.end())
        {
          log_debug("session not found - create new");
          sessionScope = new Sessionscope();
          sessionScope->addRef();
          sessionScopes.insert(sessionscopes_type::value_type(c.getValue(), sessionScope));
        }
        else
        {
          log_debug("session found");
          sessionScope = it->second;
          sessionScope->touch();
        }

        request.setSecureSessionScope(sessionScope);
      }
    }
    else
    {
      log_debug("secure session cookie " << currentSessionCookieName
          << " not checked in non ssl request");
    }

    // set application-scope
    request.setApplicationScope(getApplicationScope(app));
  }
开发者ID:913862627,项目名称:tntnet,代码行数:88,代码来源:scopemanager.cpp


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