本文整理汇总了C++中HttpConnection::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ HttpConnection::begin方法的具体用法?C++ HttpConnection::begin怎么用?C++ HttpConnection::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpConnection
的用法示例。
在下文中一共展示了HttpConnection::begin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HttpMultipartEntity
void
ProjectGiraffeTab4::OnAppControlCompleteResponseReceived(const AppId &appId, const String &operationId, AppCtrlResult appControlResult, const IMap *extraData)
{
AppLogTag("camera1", "appid %ls opid %ls", appId.GetPointer(), operationId.GetPointer());
if (appId.Equals(L"tizen.filemanager", true) &&
operationId.Equals(L"http://tizen.org/appcontrol/operation/pick", true))
{
if (appControlResult == APP_CTRL_RESULT_SUCCEEDED) {
AppLogTag("camera1", "Media list success.");
String pathKey = L"path";
String *filePath = (String *)extraData->GetValue(pathKey);
AppLogTag("camera1", "filepath: %ls", filePath->GetPointer());
HttpMultipartEntity* userParameters = new HttpMultipartEntity();
userParameters->Construct();
userParameters->AddFilePart(L"avatar", *filePath);
HttpConnection *connection = HttpConnection::userUpdatePutConnection(this, userParameters);
connection->begin();
// TODO: figure out when to free
// delete userParameters;
} else if (appControlResult == APP_CTRL_RESULT_CANCELED) {
AppLogTag("camera1", "Media list canceled.");
} else if (appControlResult == APP_CTRL_RESULT_FAILED) {
AppLogTag("camera1", "Media list failed.");
}
} else if (appId.Equals(L"tizen.camera", true) &&
operationId.Equals(L"http://tizen.org/appcontrol/operation/createcontent", true))
{
AppLogTag("camera1", "camcam");
if (appControlResult == APP_CTRL_RESULT_SUCCEEDED) {
AppLogTag("camera1", "Camera capture success.");
String pathKey = L"path";
String *filePath = (String *)extraData->GetValue(pathKey);
AppLogTag("camera1", "filepath: %ls", filePath->GetPointer());
HttpMultipartEntity* userParameters = new HttpMultipartEntity();
userParameters->Construct();
userParameters->AddFilePart(L"avatar", *filePath);
HttpConnection *connection = HttpConnection::userUpdatePutConnection(this, userParameters);
connection->begin();
// TODO: figure out when to free
// delete userParameters;
} else if (appControlResult == APP_CTRL_RESULT_CANCELED) {
AppLogTag("camera1", "Camera capture canceled.");
} else if (appControlResult == APP_CTRL_RESULT_FAILED) {
AppLogTag("camera1", "Camera capture failed.");
} else if (appControlResult == APP_CTRL_RESULT_TERMINATED) {
AppLogTag("camera1", "Camera capture terminated.");
} else if (appControlResult == APP_CTRL_RESULT_ABORTED) {
AppLogTag("camera1", "Camera capture aborted.");
}
}
}
示例2:
void
ProjectGiraffeTab4::updateItems()
{
AppLog("updating items");
HttpConnection *connection = HttpConnection::userPostsGetConnection(this,User::currentUser()->id());
connection->begin();
}
示例3: User
void
ProjectGiraffeTab1::updateItems()
{
#if kDebugUseDummyItems
AppLog("Creating dummy items");
User *dummyUser = new User();
dummyUser->setUsername(L"Username");
for (int i = 0; i < 10; i++) {
Graffiti *graffiti = new Graffiti();
graffiti->setUser(dummyUser);
graffiti->setText(L"dummy string");
_items->Add(graffiti);
}
#else
#if kDebugUseHttpConnection
double latitude = ProjectGiraffeMainForm::currentLatitude;
double longitude = ProjectGiraffeMainForm::currentLongitude;
HttpConnection *connection = HttpConnection::graffitiNearbyGetConnection(this,latitude,longitude);
connection->begin();
#else
// Kick off http request for items based on location.
// Populate item source array
HttpSession* pHttpSession = null;
HttpTransaction* pHttpTransaction = null;
String* pProxyAddr = null;
String hostAddr = L"http://ec2-54-243-69-6.compute-1.amazonaws.com/";
String uri = L"http://ec2-54-243-69-6.compute-1.amazonaws.com/";
AppLog("Starting the HTTP Session");
pHttpSession = new HttpSession();
// HttpSession construction.
pHttpSession->Construct(NET_HTTP_SESSION_MODE_NORMAL, pProxyAddr, hostAddr, null);
// Open a new HttpTransaction.
pHttpTransaction = pHttpSession->OpenTransactionN();
// Add a listener.
pHttpTransaction->AddHttpTransactionListener(*this);
// Get an HTTP request.
HttpRequest* pHttpRequest = pHttpTransaction->GetRequest();
// Set the HTTP method and URI:
pHttpRequest->SetMethod(NET_HTTP_METHOD_GET);
pHttpRequest->SetUri(uri);
// Submit the request:
pHttpTransaction->Submit();
#endif
#endif
}