defines the object which users must packed for HttpClient::send(HttpRequest*) method. More...
#include <HttpRequest.h>
Classes | |
class | _prxy |
Public Types | |
enum | Type { GET, POST, PUT, DELETE, UNKNOWN } |
Use this enum type as param in setReqeustType(param) More... | |
Public Member Functions | |
HttpRequest () | |
Constructor Because HttpRequest object will be used between UI thead and network thread, requestObj->autorelease() is forbidden to avoid crashes in AutoreleasePool new/retain/release still works, which means you need to release it manually Please refer to HttpRequestTest.cpp to find its usage. More... | |
virtual | ~HttpRequest () |
Destructor. More... | |
local | ~HttpRequest () |
Destructor. More... | |
Ref * | autorelease (void) |
Override autorelease method to avoid developers to call it. More... | |
var | autorelease () |
Override autorelease method to avoid developers to call it. More... | |
local | autorelease () |
Override autorelease method to avoid developers to call it. More... | |
void | setRequestType (Type type) |
Required field for HttpRequest object before being sent. More... | |
var | setRequestType ( var type) |
Required field for HttpRequest object before being sent. More... | |
local | setRequestType ( local type) |
Required field for HttpRequest object before being sent. More... | |
Type | getRequestType () |
Get back the kHttpGet/Post/... More... | |
var | getRequestType () |
Get back the kHttpGet/Post/... More... | |
local | getRequestType () |
Get back the kHttpGet/Post/... More... | |
void | setUrl (const char *url) |
Required field for HttpRequest object before being sent. More... | |
var | setUrl ( var url) |
Required field for HttpRequest object before being sent. More... | |
local | setUrl ( local url) |
Required field for HttpRequest object before being sent. More... | |
const char * | getUrl () |
Get back the setted url. More... | |
var | getUrl () |
Get back the setted url. More... | |
local | getUrl () |
Get back the setted url. More... | |
void | setRequestData (const char *buffer, size_t len) |
Option field. More... | |
var | setRequestData ( var buffer, var len) |
Option field. More... | |
local | setRequestData ( local buffer, local len) |
Option field. More... | |
char * | getRequestData () |
Get the request data pointer back. More... | |
var | getRequestData () |
Get the request data pointer back. More... | |
local | getRequestData () |
Get the request data pointer back. More... | |
ssize_t | getRequestDataSize () |
Get the size of request data back. More... | |
var | getRequestDataSize () |
Get the size of request data back. More... | |
local | getRequestDataSize () |
Get the size of request data back. More... | |
void | setTag (const char *tag) |
Option field. More... | |
var | setTag ( var tag) |
Option field. More... | |
local | setTag ( local tag) |
Option field. More... | |
const char * | getTag () |
Get the string tag back to identify the request. More... | |
void | setUserData (void *pUserData) |
Option field. More... | |
void * | getUserData () |
Get the pre-setted custom data pointer back. More... | |
void | setResponseCallback (Ref *pTarget, SEL_CallFuncND pSelector) |
Required field. More... | |
var | setResponseCallback ( var pTarget, var pSelector) |
Required field. More... | |
local | setResponseCallback ( local pTarget, local pSelector) |
Required field. More... | |
void | setResponseCallback (Ref *pTarget, SEL_HttpResponse pSelector) |
var | setResponseCallback ( var pTarget, var pSelector) |
local | setResponseCallback ( local pTarget, local pSelector) |
void | setResponseCallback (const ccHttpRequestCallback &callback) |
var | setResponseCallback ( var callback) |
local | setResponseCallback ( local callback) |
Ref * | getTarget () |
Get the target of callback selector funtion, mainly used by HttpClient. More... | |
_prxy | getSelector () |
Get the selector function pointer, mainly used by HttpClient. More... | |
var | getSelector () |
Get the selector function pointer, mainly used by HttpClient. More... | |
local | getSelector () |
Get the selector function pointer, mainly used by HttpClient. More... | |
const ccHttpRequestCallback & | getCallback () |
local | getCallback () |
void | setHeaders (std::vector< std::string > pHeaders) |
Set any custom headers. More... | |
var | setHeaders ( var pHeaders) |
Set any custom headers. More... | |
local | setHeaders ( local pHeaders) |
Set any custom headers. More... | |
std::vector< std::string > | getHeaders () |
Get custom headers. More... | |
Public Member Functions inherited from Ref | |
void | retain () |
Retains the ownership. More... | |
void | release () |
Releases the ownership immediately. More... | |
Ref * | autorelease () |
Releases the ownership sometime soon automatically. More... | |
unsigned int | getReferenceCount () const |
Returns the Ref's current reference count. More... | |
virtual | ~Ref () |
Protected Attributes | |
Type | _requestType |
std::string | _url |
kHttpRequestGet, kHttpRequestPost or other enums More... | |
var | _url |
kHttpRequestGet, kHttpRequestPost or other enums More... | |
local | _url |
kHttpRequestGet, kHttpRequestPost or other enums More... | |
std::vector< char > | _requestData |
target url that this request is sent to More... | |
var | _requestData |
target url that this request is sent to More... | |
local | _requestData |
target url that this request is sent to More... | |
std::string | _tag |
used for POST More... | |
var | _tag |
used for POST More... | |
local | _tag |
used for POST More... | |
Ref * | _pTarget |
user defined tag, to identify different requests in response callback More... | |
var | _pTarget |
user defined tag, to identify different requests in response callback More... | |
local | _pTarget |
user defined tag, to identify different requests in response callback More... | |
SEL_HttpResponse | _pSelector |
callback target of pSelector function More... | |
var | _pSelector |
callback target of pSelector function More... | |
local | _pSelector |
callback target of pSelector function More... | |
ccHttpRequestCallback | _pCallback |
callback function, e.g. MyLayer::onHttpResponse(HttpClient *sender, HttpResponse * response) More... | |
var | _pCallback |
callback function, e.g. MyLayer::onHttpResponse(HttpClient *sender, HttpResponse * response) More... | |
local | _pCallback |
callback function, e.g. MyLayer::onHttpResponse(HttpClient *sender, HttpResponse * response) More... | |
void * | _pUserData |
C++11 style callbacks. More... | |
std::vector< std::string > | _headers |
You can add your customed data here. More... | |
var | _headers |
You can add your customed data here. More... | |
local | _headers |
You can add your customed data here. More... | |
Protected Attributes inherited from Ref | |
unsigned int | _referenceCount |
count of references More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Ref | |
Ref () | |
Constructor. More... | |
defines the object which users must packed for HttpClient::send(HttpRequest*) method.
Please refer to tests/test-cpp/Classes/ExtensionTest/NetworkTest/HttpClientTest.cpp as a sample
|
strong |
|
strong |
|
strong |
|
inline |
Constructor Because HttpRequest object will be used between UI thead and network thread, requestObj->autorelease() is forbidden to avoid crashes in AutoreleasePool new/retain/release still works, which means you need to release it manually Please refer to HttpRequestTest.cpp to find its usage.
|
inlinevirtual |
Destructor.
|
inlinevirtual |
Destructor.
|
inlinevirtual |
Destructor.
|
inline |
Override autorelease method to avoid developers to call it.
|
inline |
Override autorelease method to avoid developers to call it.
|
inline |
Override autorelease method to avoid developers to call it.
|
inline |
|
inline |
|
inline |
|
inline |
Get custom headers.
|
inline |
Get custom headers.
|
inline |
Get custom headers.
|
inline |
Get the request data pointer back.
|
inline |
Get the request data pointer back.
|
inline |
Get the request data pointer back.
|
inline |
Get the size of request data back.
|
inline |
Get the size of request data back.
|
inline |
Get the size of request data back.
|
inline |
Get back the kHttpGet/Post/...
enum value
|
inline |
Get back the kHttpGet/Post/...
enum value
|
inline |
Get back the kHttpGet/Post/...
enum value
|
inline |
Get the selector function pointer, mainly used by HttpClient.
|
inline |
Get the selector function pointer, mainly used by HttpClient.
|
inline |
Get the selector function pointer, mainly used by HttpClient.
|
inline |
Get the string tag back to identify the request.
The best practice is to use it in your MyClass::onMyHttpRequestCompleted(sender, HttpResponse*) callback
|
inline |
Get the string tag back to identify the request.
The best practice is to use it in your MyClass::onMyHttpRequestCompleted(sender, HttpResponse*) callback
|
inline |
Get the string tag back to identify the request.
The best practice is to use it in your MyClass::onMyHttpRequestCompleted(sender, HttpResponse*) callback
|
inline |
Get the target of callback selector funtion, mainly used by HttpClient.
|
inline |
Get the target of callback selector funtion, mainly used by HttpClient.
|
inline |
Get the target of callback selector funtion, mainly used by HttpClient.
|
inline |
Get back the setted url.
|
inline |
Get back the setted url.
|
inline |
Get back the setted url.
|
inline |
Get the pre-setted custom data pointer back.
Don't forget to delete it. HttpClient/HttpResponse/HttpRequest will do nothing with this pointer
|
inline |
Get the pre-setted custom data pointer back.
Don't forget to delete it. HttpClient/HttpResponse/HttpRequest will do nothing with this pointer
|
inline |
Get the pre-setted custom data pointer back.
Don't forget to delete it. HttpClient/HttpResponse/HttpRequest will do nothing with this pointer
|
inline |
Set any custom headers.
|
inline |
Set any custom headers.
|
inline |
Set any custom headers.
|
inline |
Option field.
You can set your post data here
|
inline |
Option field.
You can set your post data here
|
inline |
Option field.
You can set your post data here
|
inline |
Required field for HttpRequest object before being sent.
kHttpGet & kHttpPost is currently supported
|
inline |
Required field for HttpRequest object before being sent.
kHttpGet & kHttpPost is currently supported
|
inline |
Required field for HttpRequest object before being sent.
kHttpGet & kHttpPost is currently supported
|
inline |
Required field.
You should set the callback selector function at ack the http request completed
|
inline |
Required field.
You should set the callback selector function at ack the http request completed
|
inline |
Required field.
You should set the callback selector function at ack the http request completed
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Option field.
You can set a string tag to identify your request, this tag can be found in HttpResponse->getHttpRequest->getTag()
|
inline |
Option field.
You can set a string tag to identify your request, this tag can be found in HttpResponse->getHttpRequest->getTag()
|
inline |
Option field.
You can set a string tag to identify your request, this tag can be found in HttpResponse->getHttpRequest->getTag()
|
inline |
Required field for HttpRequest object before being sent.
|
inline |
Required field for HttpRequest object before being sent.
|
inline |
Required field for HttpRequest object before being sent.
|
inline |
Option field.
You can attach a customed data in each request, and get it back in response callback. But you need to new/delete the data pointer manully
|
inline |
Option field.
You can attach a customed data in each request, and get it back in response callback. But you need to new/delete the data pointer manully
|
inline |
Option field.
You can attach a customed data in each request, and get it back in response callback. But you need to new/delete the data pointer manully
|
protected |
You can add your customed data here.
|
protected |
You can add your customed data here.
|
protected |
You can add your customed data here.
|
protected |
callback function, e.g. MyLayer::onHttpResponse(HttpClient *sender, HttpResponse * response)
|
protected |
callback function, e.g. MyLayer::onHttpResponse(HttpClient *sender, HttpResponse * response)
|
protected |
callback function, e.g. MyLayer::onHttpResponse(HttpClient *sender, HttpResponse * response)
|
protected |
callback target of pSelector function
|
protected |
callback target of pSelector function
|
protected |
callback target of pSelector function
|
protected |
user defined tag, to identify different requests in response callback
|
protected |
user defined tag, to identify different requests in response callback
|
protected |
user defined tag, to identify different requests in response callback
|
protected |
C++11 style callbacks.
|
protected |
C++11 style callbacks.
|
protected |
C++11 style callbacks.
|
protected |
target url that this request is sent to
|
protected |
target url that this request is sent to
|
protected |
target url that this request is sent to
|
protected |
|
protected |
|
protected |
|
protected |
used for POST
|
protected |
used for POST
|
protected |
used for POST
|
protected |
kHttpRequestGet, kHttpRequestPost or other enums
|
protected |
kHttpRequestGet, kHttpRequestPost or other enums
|
protected |
kHttpRequestGet, kHttpRequestPost or other enums