defines the object which users will receive at onHttpCompleted(sender, HttpResponse) callback. More...
Inherits Ref.
Public Member Functions | |
HttpResponse (HttpRequest *request) | |
Constructor, it's used by HttpClient internal, users don't need to create HttpResponse manually. More... | |
virtual | ~HttpResponse () |
Destructor, it will be called in HttpClient internal. More... | |
cocos2d::Ref * | autorelease () |
Override autorelease method to prevent developers from calling it. More... | |
HttpRequest * | getHttpRequest () const |
Get the corresponding HttpRequest object which leads to this response. More... | |
var | getHttpRequest () |
Get the corresponding HttpRequest object which leads to this response. More... | |
bool | isSucceed () const |
To see if the http request is returned successfully. More... | |
std::vector< char > * | getResponseData () |
Get the http response data. More... | |
std::vector< char > * | getResponseHeader () |
Get the response headers. More... | |
var | getResponseHeader () |
Get the response headers. More... | |
long | getResponseCode () const |
Get the http response code to judge whether response is successful or not. More... | |
var | getResponseCode () |
Get the http response code to judge whether response is successful or not. More... | |
const char * | getErrorBuffer () const |
Get the error buffer which will tell you more about the reason why http request failed. More... | |
void | setSucceed (bool value) |
Set whether the http request is returned successfully or not, This setter is mainly used in HttpClient, users mustn't set it directly. More... | |
var | setSucceed ( var value) |
Set whether the http request is returned successfully or not, This setter is mainly used in HttpClient, users mustn't set it directly. More... | |
void | setResponseData (std::vector< char > *data) |
Set the http response data buffer, it is used by HttpClient. More... | |
void | setResponseHeader (std::vector< char > *data) |
Set the http response headers buffer, it is used by HttpClient. More... | |
var | setResponseHeader ( var data) |
Set the http response headers buffer, it is used by HttpClient. More... | |
void | setResponseCode (long value) |
Set the http response code. More... | |
void | setErrorBuffer (const char *value) |
Set the error buffer which will tell you more the reason why http request failed. More... | |
void | setResponseDataString (const char *value, size_t n) |
Set the response data by the string pointer and the defined size. More... | |
var | setResponseDataString ( var value, var n) |
Set the response data by the string pointer and the defined size. More... | |
const char * | getResponseDataString () const |
Get the string pointer that point to the response data. More... | |
Public Member Functions inherited from Ref | |
void | retain () |
Retains the ownership. More... | |
void | release () |
Releases the ownership immediately. More... | |
local | 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. More... | |
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. | |
defines the object which users will receive at onHttpCompleted(sender, HttpResponse) callback.
Please refer to samples/TestCpp/Classes/ExtensionTest/NetworkTest/HttpClientTest.cpp as a sample.
|
inline |
Constructor, it's used by HttpClient internal, users don't need to create HttpResponse manually.
request | the corresponding HttpRequest which leads to this response. |
|
inline |
Constructor, it's used by HttpClient internal, users don't need to create HttpResponse manually.
request | the corresponding HttpRequest which leads to this response. |
|
inlinevirtual |
Destructor, it will be called in HttpClient internal.
Users don't need to destruct HttpResponse object manually.
|
inlinevirtual |
Destructor, it will be called in HttpClient internal.
Users don't need to destruct HttpResponse object manually.
|
inline |
Override autorelease method to prevent developers from calling it.
If this method is called , it would trigger CCASSERT.
|
inline |
Override autorelease method to prevent developers from calling it.
If this method is called , it would trigger CCASSERT.
|
inline |
Get the corresponding HttpRequest object which leads to this response.
There's no paired setter for it, because it's already set in class constructor
|
inline |
Get the corresponding HttpRequest object which leads to this response.
There's no paired setter for it, because it's already set in class constructor
|
inline |
To see if the http request is returned successfully.
Although users can judge if (http response code = 200), we want an easier way. If this getter returns false, you can call getResponseCode and getErrorBuffer to find more details.
|
inline |
To see if the http request is returned successfully.
Although users can judge if (http response code = 200), we want an easier way. If this getter returns false, you can call getResponseCode and getErrorBuffer to find more details.
|
inline |
Get the http response data.
|
inline |
Get the http response data.
|
inline |
Get the response headers.
|
inline |
Get the response headers.
|
inline |
Get the http response code to judge whether response is successful or not.
I know that you want to see the _responseCode is 200. If _responseCode is not 200, you should check the meaning for _responseCode by the net.
|
inline |
Get the http response code to judge whether response is successful or not.
I know that you want to see the _responseCode is 200. If _responseCode is not 200, you should check the meaning for _responseCode by the net.
|
inline |
Get the error buffer which will tell you more about the reason why http request failed.
|
inline |
Get the error buffer which will tell you more about the reason why http request failed.
|
inline |
Set whether the http request is returned successfully or not, This setter is mainly used in HttpClient, users mustn't set it directly.
value | the flag represent whether the http request is successful or not. |
|
inline |
Set whether the http request is returned successfully or not, This setter is mainly used in HttpClient, users mustn't set it directly.
value | the flag represent whether the http request is successful or not. |
|
inline |
Set the http response data buffer, it is used by HttpClient.
data | the pointer point to the response data buffer. |
|
inline |
Set the http response data buffer, it is used by HttpClient.
data | the pointer point to the response data buffer. |
|
inline |
Set the http response headers buffer, it is used by HttpClient.
data | the pointer point to the response headers buffer. |
|
inline |
Set the http response headers buffer, it is used by HttpClient.
data | the pointer point to the response headers buffer. |
|
inline |
Set the http response code.
value | the http response code that represent whether the request is successful or not. |
|
inline |
Set the http response code.
value | the http response code that represent whether the request is successful or not. |
|
inline |
Set the error buffer which will tell you more the reason why http request failed.
value | a string pointer that point to the reason. |
|
inline |
Set the error buffer which will tell you more the reason why http request failed.
value | a string pointer that point to the reason. |
|
inline |
Set the response data by the string pointer and the defined size.
value | a string pointer that point to response data buffer. |
n | the defined size that the response data buffer would be copied. |
|
inline |
Set the response data by the string pointer and the defined size.
value | a string pointer that point to response data buffer. |
n | the defined size that the response data buffer would be copied. |
|
inline |
Get the string pointer that point to the response data.
|
inline |
Get the string pointer that point to the response data.