本文整理汇总了C++中CCHttpRequest::release方法的典型用法代码示例。如果您正苦于以下问题:C++ CCHttpRequest::release方法的具体用法?C++ CCHttpRequest::release怎么用?C++ CCHttpRequest::release使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCHttpRequest
的用法示例。
在下文中一共展示了CCHttpRequest::release方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onMenuDeleteTestClicked
void HttpClientTest::onMenuDeleteTestClicked(CCObject *sender)
{
// test 1
{
CCHttpRequest* request = new CCHttpRequest();
request->setUrl("http://just-make-this-request-failed.com");
request->setRequestType(CCHttpRequest::kHttpDelete);
request->setResponseCallback(this, httpresponse_selector(HttpClientTest::onHttpRequestCompleted));
request->setTag("DELETE test1");
CCHttpClient::getInstance()->send(request);
request->release();
}
// test 2
{
CCHttpRequest* request = new CCHttpRequest();
request->setUrl("http://httpbin.org/delete");
request->setRequestType(CCHttpRequest::kHttpDelete);
request->setResponseCallback(this, httpresponse_selector(HttpClientTest::onHttpRequestCompleted));
request->setTag("DELETE test2");
CCHttpClient::getInstance()->send(request);
request->release();
}
// waiting
m_labelStatusCode->setString("waiting...");
}
示例2: doSearchFriend
void AddFriendScene::doSearchFriend()
{
std::string sSearchField(m_txtSearchField->getText());
sSearchField = trimRight(sSearchField);
if (sSearchField.empty()) {
CCMessageBox("搜索内容不能为空","ERROR");
return;
}
this->ShowLoadingIndicator("");
CCHttpRequest *request = new CCHttpRequest();
request->setRequestType(CCHttpRequest::kHttpGet);
request->setResponseCallback(this,httpresponse_selector(AddFriendScene::requestFinishedCallback));
request->setTag("101");
string _strUrl = CompleteUrl(URL_FRIEND_SEARCH);
_strUrl.append(CCUserDefault::sharedUserDefault()->getStringForKey("userinfo"));
_strUrl.append("/");
_strUrl.append(sSearchField);
request->setUrl(_strUrl.c_str());
CCHttpClient *client = CCHttpClient::getInstance();
client->send(request);
request->release();
}
示例3: ProfileTimer
void RequestTopaz::ProfileTimer(float f)
{
// 프로필 사진 왼쪽 위 지점과 스크롤뷰 위치를 비교한다.
// 음수가 되면, 아래에 있던 프로필이 스크롤뷰에 보이기 시작했다는 의미 -> 프로필 로딩 시작.
CCPoint p;
float h;
int numOfList = friendList.size();
for (int i = 0 ; i < friendList.size() ; i++)
{
ProfileSprite* psp = ProfileSprite::GetObj(friendList[i]->GetImageUrl());
if (psp->IsLoadingStarted() || psp->IsLoadingDone())
continue;
if (spriteClassScroll == NULL)
return;
p = ((CCSprite*)spriteClassScroll->FindSpriteByTag(-888*(numOfList-i)))->convertToNodeSpace(scrollView->getPosition());
h = friendList[i]->GetProfile()->getContentSize().height;
if (p.y - h < 0)
{
psp->SetLoadingStarted(true);
char tag[6];
CCHttpRequest* req = new CCHttpRequest();
req->setUrl(psp->GetProfileUrl().c_str());
req->setRequestType(CCHttpRequest::kHttpPost);
req->setResponseCallback(this, httpresponse_selector(RequestTopaz::onHttpRequestCompletedNoEncrypt));
sprintf(tag, "%d", i);
req->setTag(tag);
CCHttpClient::getInstance()->send(req);
req->release();
}
}
}
示例4: LogInHTTP
void LogInScene::LogInHTTP(){
closeLogInTable();
if (UserNameStr != "" && PassWordStr !="" && ((UserNameStr != MainUser->UserNameStr && MainUser->hasLogIn) || !MainUser->hasLogIn)) {
box = AsMessageBox::createMessageBox("通信中,请稍候", 1, 0);
box->setPosition(CCPointZero);
addChild(box,100);
CCHttpRequest* request = new CCHttpRequest();
string UrlData = "http://115.29.168.228/users/signin?user[name]=" + UserNameStr + "&user[password]=" + PassWordStr;
request->setUrl(UrlData.c_str());
request->setRequestType(CCHttpRequest::kHttpGet);
request->setResponseCallback(this, callfuncND_selector(LogInScene::LogInRequestCompleted));
CCHttpClient::getInstance()->send(request);
request->release();
}
else if(UserNameStr == ""){
box = AsMessageBox::createMessageBox("请输入用户名", 2, 1);
box->setPosition(CCPointZero);
addChild(box,100);
}
else if(UserNameStr == MainUser->UserNameStr){
box = AsMessageBox::createMessageBox("该账户已经登录", 2, 1);
box->setPosition(CCPointZero);
addChild(box,100);
}
else if(PassWordStr == ""){
box = AsMessageBox::createMessageBox("请输入密码", 2, 1);
box->setPosition(CCPointZero);
addChild(box,100);
}
}
示例5: downloadPhoto
void EziSocialObject::downloadPhoto(CCLayer* parentNode, const char *fbID, const char *fbURL, const char* filename, bool forceDownloadFromServer)
{
if (forceDownloadFromServer == false) // Check if local copy exist
{
std::string file = cocos2d::CCFileUtils::sharedFileUtils()->getWritablePath().append(filename);
bool fileExist = cocos2d::CCFileUtils::sharedFileUtils()->isFileExist(file);
if (fileExist)
{
internalUserPhotoCallback(file.c_str(), fbID);
return;
}
}
// If we have reached here; that means local copy does not exsist. Download a new one.
CCHttpRequest* request = new CCHttpRequest();
request->setUrl(fbURL);
request->setRequestType(CCHttpRequest::kHttpGet);
request->setResponseCallback(parentNode, httpresponse_selector(EziSocialObject::onHttpRequestCompleted));
request->setTag(filename);
CCHttpClient::getInstance()->send(request);
request->release();
}
示例6: rechargeOnClick
void QimiAlipayView::rechargeOnClick(cocos2d::CCNode* pSender, cocos2d::extension::CCControlEvent* pCCControlEvent)
{
m_money = atoi(m_pEditName->getText());
CCHttpRequest* request = new CCHttpRequest();
request->setUrl("http://www.qimi.com/platform/addOrder.php");
request->setRequestType(CCHttpRequest::kHttpPost);
request->setResponseCallback(this, httpresponse_selector(QimiAlipayView::onLoadOrderSucssful));
char sign[255];
sprintf(sign, "%s%d%s",
m_uId.c_str(),
m_sId,
m_key.c_str());
QimiMD5 md5;
md5.update(sign);
CCLog("md5str==%s",sign);
std::string md5tolower = md5.toString();
CCString* postDataStr = CCString::createWithFormat("uId=%s&sId=%d&sign=%s&money=%d&orderType=alipay&type=0", m_uId.c_str(), m_sId, md5tolower.c_str(), m_money);
CCLog("addOrder string ===%s", postDataStr->getCString());
const char* postData =postDataStr->getCString();
request->setRequestData(postData, strlen(postData));
request->setTag("POST test1");
CCHttpClient::getInstance()->send(request);
request->release();
RequestLoadingView* mask = RequestLoadingView::create();
mask->setTag(100000);
this->addChild(mask);
}
示例7: getHeroInformationHTTP
void ASUser::getHeroInformationHTTP(){
CCHttpRequest* request = new CCHttpRequest();
string UrlData = "http://115.29.168.228/roles?token=" + UserTokenStr;
request->setUrl(UrlData.c_str());
request->setRequestType(CCHttpRequest::kHttpGet);
request->setResponseCallback(this, callfuncND_selector(ASUser::getHeroInformationRequestCompleted));
CCHttpClient::getInstance()->send(request);
request->release();
}
示例8: testUrl
void CLoginScene::testUrl()
{
CSceneManager::sharedSceneManager()->openPopupBox(GETBOX(CLoadingBox), (void*)(""));
OppoServer* pServer = OppoServer::shareOppoServer();
CCHttpRequest* request = CHttpServer::getGetRequestByUrl("http://www.bsdfsaidu.com");
request->setResponseCallback(this, callfuncND_selector(CLoginScene::urlCallback));
pServer->send(request);
request->release();
}
示例9: onMenuGetTestClicked
void HttpClientTest::onMenuGetTestClicked(cocos2d::CCObject *sender)
{
// test 1
{
CCHttpRequest* request = new CCHttpRequest();
request->setUrl("http://just-make-this-request-failed.com");
request->setRequestType(CCHttpRequest::kHttpGet);
request->setResponseCallback(this, httpresponse_selector(HttpClientTest::onHttpRequestCompleted));
request->setTag("GET test1");
CCHttpClient::getInstance()->send(request);
request->release();
}
// test 2
{
CCHttpRequest* request = new CCHttpRequest();
// required fields
request->setUrl("http://httpbin.org/ip");
request->setRequestType(CCHttpRequest::kHttpGet);
request->setResponseCallback(this, httpresponse_selector(HttpClientTest::onHttpRequestCompleted));
// optional fields
request->setTag("GET test2");
CCHttpClient::getInstance()->send(request);
// don't forget to release it, pair to new
request->release();
}
// test 3
{
CCHttpRequest* request = new CCHttpRequest();
request->setUrl("http://httpbin.org/get");
request->setRequestType(CCHttpRequest::kHttpGet);
request->setResponseCallback(this, httpresponse_selector(HttpClientTest::onHttpRequestCompleted));
request->setTag("GET test3");
CCHttpClient::getInstance()->send(request);
request->release();
}
// waiting
m_labelStatusCode->setString("waiting...");
}
示例10: sendData
void YHHttpClient::sendData(YHByteArray * bytes, CCHttpRequest::HttpRequestType type)
{
CCHttpRequest * request = new CCHttpRequest();
request->setRequestType(type);
request->setUrl(m_url.c_str());
request->setRequestData((const char *)bytes->getBuffer(), bytes->readableBytes());
request->setResponseCallback(this, httpresponse_selector(YHHttpClient::onResponseCallBack));
m_httpClient->send(request);
request->release();
}
示例11: getServerTime
void RankScene::getServerTime(){
CCHttpRequest* request = new CCHttpRequest();
string UrlData = "http://115.29.168.228/time";
request->setUrl(UrlData.c_str());
request->setRequestType(CCHttpRequest::kHttpGet);
request->setResponseCallback(this, callfuncND_selector(RankScene::getServerTimeRequestCompleted));
CCHttpClient::getInstance()->send(request);
request->release();
}
示例12: sendRequest
void Http::sendRequest(const char *data, unsigned length)
{
CCHttpRequest *pRequest = new CCHttpRequest();
pRequest->setUrl(mURL.c_str());
pRequest->setRequestType(CCHttpRequest::kHttpPost);
pRequest->setResponseCallback(this, httpresponse_selector(Http::recvResponse));
pRequest->setRequestData(data, length);
CCHttpClient::getInstance()->send(pRequest);
pRequest->release();
}
示例13: getRankHTTP
void RankScene::getRankHTTP(){
CCHttpRequest* request = new CCHttpRequest();
string UrlData = "http://115.29.168.228/winning_boards/" + int2string(tibaoType) + "/whereami?token=" + MainUser->UserTokenStr;
request->setUrl(UrlData.c_str());
request->setRequestType(CCHttpRequest::kHttpGet);
request->setResponseCallback(this, callfuncND_selector(RankScene::getRankRequestCompleted));
CCHttpClient::getInstance()->send(request);
request->release();
}
示例14: downloadConfigFileListOneTime
bool ShopItemInfoFromServer::downloadConfigFileListOneTime(const char* url,const char* postMessage)
{
if (url == NULL) {
return false;
}
std::string strHtml = "";
std::string strRetData = "";
CURLcode curlRes;
CURL* easyCurl = curl_easy_init();
if (easyCurl == NULL) {
return false;
}
ShopItemInfoFromServer::sharedInstance()->m_strFileList = "";
//curl_easy_setopt(easyCurl, CURLOPT_WRITEFUNCTION, &ShopItemInfoFromServer::configFileDownLoadCallback);
//curl_easy_setopt(easyCurl, CURLOPT_POSTFIELDS, postMessage);
//curl_easy_setopt(easyCurl, CURLOPT_WRITEDATA, &strHtml);
//curl_easy_setopt(easyCurl, CURLOPT_URL,url);
//curl_easy_setopt(easyCurl, CURLOPT_POST, 1);
//curl_easy_setopt(easyCurl, CURLOPT_FOLLOWLOCATION, true);
//curlRes = curl_easy_perform(easyCurl);
//curl_easy_cleanup(easyCurl);
curl_easy_setopt(easyCurl,CURLOPT_URL,url);
// curl_easy_setopt(easyCurl, CURLOPT_CONNECTTIMEOUT,2.5);
curl_easy_setopt(easyCurl,CURLOPT_WRITEFUNCTION,&ShopItemInfoFromServer::configFileDownLoadCallback);
curlRes=curl_easy_perform(easyCurl);
if(curlRes!=CURLE_OK)
{
char temp[100];
snprintf(temp,100, "failed to get product list err code %i",curlRes);
//AppDelegate::GetShareAppDelegate()->ShowToast(temp);
CCLOG("%s", temp);
#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
//send failed log to c01
{
CCHttpRequest* request = new CCHttpRequest();
snprintf( temp,100, "http://report.st.61.com/misc.js?gameid=82&step=3&flag=%d",curlRes);
request->setUrl(temp);
request->setRequestType(CCHttpRequest::kHttpGet);
request->setResponseCallback((CCObject*)this, callfuncND_selector(ShopItemInfoFromServer::onHttpRequestCompleted));
CCHttpClient::getInstance()->send(request);
request->release();
}
#endif
}
curl_easy_cleanup(easyCurl);
bool result = (curlRes == CURLE_OK);
return result;
}
示例15: BottonOKClicked
void LoginLayer::BottonOKClicked( CCObject* pSender )
{
CCHttpRequest* request = new CCHttpRequest();
std::string url = "http://127.0.0.1:8000/member/" + std::string(m_pTextField->getString());
request->setUrl(url.c_str());
request->setRequestType(CCHttpRequest::kHttpGet);
request->setResponseCallback(this, httpresponse_selector(LoginLayer::onHttpRequestCompleted));
request->setTag("GET test1");
CCHttpClient::getInstance()->send(request);
request->release();
}