Defines the object which users must packed for HttpClient::send(HttpRequest*) method. More...
Inherits Ref.
Classes | |
class | _prxy |
This sub class is just for migration SEL_CallFuncND to SEL_HttpResponse,someday this way will be removed. More... | |
Public Types | |
enum | Type |
The HttpRequest type enum used in the HttpRequest::setRequestType. | |
Public Member Functions | |
HttpRequest () | |
Constructor. More... | |
virtual | ~HttpRequest () |
Destructor. | |
var | ~HttpRequest () |
Destructor. | |
Ref * | autorelease () |
Override autorelease method to avoid developers to call it. More... | |
var | autorelease () |
Override autorelease method to avoid developers to call it. More... | |
void | setRequestType (Type type) |
Set request type of HttpRequest object before being sent,now it support the enum value of HttpRequest::Type. More... | |
Type | getRequestType () const |
Get the request type of HttpRequest object. More... | |
void | setUrl (const std::string &url) |
Set the url address of HttpRequest object. More... | |
var | setUrl ( var url) |
Set the url address of HttpRequest object. More... | |
const char * | getUrl () const |
Get the url address of HttpRequest object. More... | |
void | setRequestData (const char *buffer, size_t len) |
Set the request data of HttpRequest object. More... | |
var | setRequestData ( var buffer, var len) |
Set the request data of HttpRequest object. More... | |
char * | getRequestData () |
Get the request data pointer of HttpRequest object. More... | |
var | getRequestData () |
Get the request data pointer of HttpRequest object. More... | |
ssize_t | getRequestDataSize () const |
Get the size of request data. More... | |
var | getRequestDataSize () |
Get the size of request data. More... | |
void | setTag (const std::string &tag) |
Set a string tag to identify your request. More... | |
const char * | getTag () const |
Get the string tag to identify the request. More... | |
void | setUserData (void *pUserData) |
Set user-customed data of HttpRequest object. More... | |
void * | getUserData () const |
Get the user-customed data pointer which were pre-setted. More... | |
var | getUserData () |
Get the user-customed data pointer which were pre-setted. More... | |
void | setResponseCallback (Ref *pTarget, SEL_CallFuncND pSelector) |
Set the target and related callback selector. More... | |
var | setResponseCallback ( var pTarget, var pSelector) |
Set the target and related callback selector. More... | |
void | setResponseCallback (Ref *pTarget, SEL_HttpResponse pSelector) |
Set the target and related callback selector of HttpRequest object. More... | |
void | setResponseCallback (const ccHttpRequestCallback &callback) |
Set response callback function of HttpRequest object. More... | |
Ref * | getTarget () const |
Get the target of callback selector function, mainly used by HttpClient. More... | |
_prxy | getSelector () const |
Get _prxy object by the _pSelector. More... | |
var | getSelector () |
Get _prxy object by the _pSelector. More... | |
const ccHttpRequestCallback & | getCallback () const |
Get ccHttpRequestCallback callback function. More... | |
void | setHeaders (std::vector< std::string > headers) |
Set custom-defined headers. More... | |
var | setHeaders ( var headers) |
Set custom-defined headers. More... | |
std::vector< std::string > | getHeaders () const |
Get custom headers. More... | |
Public Member Functions inherited from Ref | |
void | retain () |
Retains the ownership. More... | |
local | 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... | |
local | getReferenceCount () |
Returns the Ref's current reference count. More... | |
virtual | ~Ref () |
Destructor. | |
Additional Inherited Members | |
Public Attributes inherited from Ref | |
unsigned int | _ID |
object id, ScriptSupport need public _ID | |
local | _ID |
object id, ScriptSupport need public _ID | |
int | _luaID |
Lua reference id. | |
local | _luaID |
Lua reference id. | |
void * | _scriptObject |
scriptObject, support for swift | |
local | _scriptObject |
scriptObject, support for swift | |
bool | _rooted |
When true, it means that the object was already rooted. | |
local | _rooted |
When true, it means that the object was already rooted. | |
bool | _scriptOwned |
The life of the object is scrolled by the scripting engine. More... | |
local | _scriptOwned |
The life of the object is scrolled by the scripting engine. More... | |
Defines the object which users must packed for HttpClient::send(HttpRequest*) method.
|
inline |
Constructor.
Because HttpRequest object will be used between UI thread 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
|
inline |
Constructor.
Because HttpRequest object will be used between UI thread 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
|
inline |
Override autorelease method to avoid developers to call it.
If this function was called, it would trigger assert in debug mode
always return nullptr.
|
inline |
Override autorelease method to avoid developers to call it.
If this function was called, it would trigger assert in debug mode
always return nullptr.
|
inline |
Set request type of HttpRequest object before being sent,now it support the enum value of HttpRequest::Type.
the request type.
|
inline |
Set request type of HttpRequest object before being sent,now it support the enum value of HttpRequest::Type.
the request type.
|
inline |
Get the request type of HttpRequest object.
|
inline |
Get the request type of HttpRequest object.
|
inline |
Set the url address of HttpRequest object.
The url value could be like these: "http://httpbin.org/ip" or "https://httpbin.org/get"
url the string object
|
inline |
Set the url address of HttpRequest object.
The url value could be like these: "http://httpbin.org/ip" or "https://httpbin.org/get"
url the string object
|
inline |
Get the url address of HttpRequest object.
const char* the pointer of _url.
|
inline |
Get the url address of HttpRequest object.
const char* the pointer of _url.
|
inline |
Set the request data of HttpRequest object.
the buffer of request data, it support binary data. the size of request data.
|
inline |
Set the request data of HttpRequest object.
the buffer of request data, it support binary data. the size of request data.
|
inline |
Get the request data pointer of HttpRequest object.
char* the request data pointer.
|
inline |
Get the request data pointer of HttpRequest object.
char* the request data pointer.
|
inline |
Get the size of request data.
ssize_t the size of request data
|
inline |
Get the size of request data.
ssize_t the size of request data
|
inline |
Set a string tag to identify your request.
This tag can be found in HttpResponse->getHttpRequest->getTag().
the string object
|
inline |
Set a string tag to identify your request.
This tag can be found in HttpResponse->getHttpRequest->getTag().
the string object
|
inline |
Get the string tag to identify the request.
The best practice is to use it in your MyClass::onMyHttpRequestCompleted(sender, HttpResponse*) callback.
const char* the pointer of _tag
|
inline |
Get the string tag to identify the request.
The best practice is to use it in your MyClass::onMyHttpRequestCompleted(sender, HttpResponse*) callback.
const char* the pointer of _tag
|
inline |
Set user-customed data of HttpRequest object.
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 manually.
the pointer point to customed data
|
inline |
Set user-customed data of HttpRequest object.
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 manually.
the pointer point to customed data
|
inline |
Get the user-customed data pointer which were pre-setted.
Don't forget to delete it. HttpClient/HttpResponse/HttpRequest will do nothing with this pointer.
void* the pointer of user-customed data.
|
inline |
Get the user-customed data pointer which were pre-setted.
Don't forget to delete it. HttpClient/HttpResponse/HttpRequest will do nothing with this pointer.
void* the pointer of user-customed data.
|
inline |
Set the target and related callback selector.
When response come back, it would call (pTarget->*pSelector) to process something.
the target object pointer. the callback function.
|
inline |
Set the target and related callback selector.
When response come back, it would call (pTarget->*pSelector) to process something.
the target object pointer. the callback function.
|
inline |
Set the target and related callback selector of HttpRequest object.
When response come back, we would call (pTarget->*pSelector) to process response data.
the target object pointer. the SEL_HttpResponse function.
|
inline |
Set the target and related callback selector of HttpRequest object.
When response come back, we would call (pTarget->*pSelector) to process response data.
the target object pointer. the SEL_HttpResponse function.
|
inline |
Set response callback function of HttpRequest object.
When response come back, we would call _pCallback to process response data.
the ccHttpRequestCallback function.
|
inline |
Set response callback function of HttpRequest object.
When response come back, we would call _pCallback to process response data.
the ccHttpRequestCallback function.
|
inline |
Get the target of callback selector function, mainly used by HttpClient.
Ref* the target of callback selector funtion
|
inline |
Get the target of callback selector function, mainly used by HttpClient.
Ref* the target of callback selector funtion
|
inline |
Get ccHttpRequestCallback callback function.
ccHttpRequestCallback callback function.
|
inline |
Get ccHttpRequestCallback callback function.
ccHttpRequestCallback callback function.
|
inline |
Set custom-defined headers.
the string vector of custom-defined headers.
|
inline |
Set custom-defined headers.
the string vector of custom-defined headers.
|
inline |
Get custom headers.
the string vector of custom-defined headers.
|
inline |
Get custom headers.
the string vector of custom-defined headers.