cocos2d-x  3.0Beta0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HttpResponse Class Reference

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 More...

#include <HttpResponse.h>

Inheritance diagram for HttpResponse:
Object

Public Member Functions

 HttpResponse (HttpRequest *request)
 Constructor, it's used by HttpClient internal, users don't need to create HttpResponse manually. More...
 
 HttpResponse ( var request)
 Constructor, it's used by HttpClient internal, users don't need to create HttpResponse manually. More...
 
 HttpResponse ( local 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, users don't need to desturct HttpResponse object manully. More...
 
cocos2d::Objectautorelease (void)
 Override autorelease method to prevent developers from calling it. More...
 
local autorelease ()
 Override autorelease method to prevent developers from calling it. More...
 
HttpRequestgetHttpRequest ()
 Get the corresponding HttpRequest object which leads to this response There's no paired setter for it, coz it's already setted in class constructor. More...
 
bool isSucceed ()
 To see if the http reqeust is returned successfully, Althrough users can judge if (http return code = 200), we want an easier way If this getter returns false, you can call getResponseCode and getErrorBuffer to find more details. More...
 
std::vector< char > * getResponseData ()
 Get the http response raw data. More...
 
var getResponseData ()
 Get the http response raw data. More...
 
local getResponseData ()
 Get the http response raw data. More...
 
std::vector< char > * getResponseHeader ()
 get the Rawheader More...
 
long getResponseCode ()
 Get the http response errorCode I know that you want to see http 200 :) More...
 
const char * getErrorBuffer ()
 Get the rror buffer which will tell you more about the reason why http request failed. More...
 
void setSucceed (bool value)
 Set if the http request is returned successfully, Althrough users can judge if (http code == 200), we want a easier way This setter is mainly used in HttpClient, users mustn't set it directly. More...
 
var setSucceed ( var value)
 Set if the http request is returned successfully, Althrough users can judge if (http code == 200), we want a easier way This setter is mainly used in HttpClient, users mustn't set it directly. More...
 
local setSucceed ( local value)
 Set if the http request is returned successfully, Althrough users can judge if (http code == 200), we want a easier way This setter is mainly used in HttpClient, users mustn't set it directly. More...
 
void setResponseData (std::vector< char > *data)
 Set the http response raw buffer, is used by HttpClient. More...
 
void setResponseHeader (std::vector< char > *data)
 Set the http response Header raw buffer, is used by HttpClient. More...
 
var setResponseHeader ( var data)
 Set the http response Header raw buffer, is used by HttpClient. More...
 
local setResponseHeader ( local data)
 Set the http response Header raw buffer, is used by HttpClient. More...
 
void setResponseCode (long value)
 Set the http response errorCode. More...
 
var setResponseCode ( var value)
 Set the http response errorCode. More...
 
local setResponseCode ( local value)
 Set the http response errorCode. More...
 
void setErrorBuffer (const char *value)
 Set the error buffer which will tell you more the reason why http request failed. More...
 
var setErrorBuffer ( var value)
 Set the error buffer which will tell you more the reason why http request failed. More...
 
local setErrorBuffer ( local value)
 Set the error buffer which will tell you more the reason why http request failed. More...
 
- Public Member Functions inherited from Object
 Object ()
 Constructor. More...
 
 Object ()
 Constructor. More...
 
virtual ~Object ()
void release ()
 Release the ownership immediately. More...
 
void retain ()
 Retains the ownership. More...
 
Objectautorelease ()
 Release the ownership sometime soon automatically. More...
 
bool isSingleReference () const
 Returns a boolean value that indicates whether there is only one reference to the object. More...
 
unsigned int retainCount () const
 Returns the object's current reference count. More...
 
local retainCount ()
 Returns the object's current reference count. More...
 
virtual bool isEqual (const Object *object)
 Returns a boolean value that indicates whether this object and a given object are equal. More...
 
virtual void acceptVisitor (DataVisitor &visitor)
virtual void update (float dt)

Protected Member Functions

bool initWithRequest (HttpRequest *request)

Protected Attributes

HttpRequest_pHttpRequest
bool _succeed
 the corresponding HttpRequest pointer who leads to this response More...
 
std::vector< char > _responseData
 to indecate if the http reqeust is successful simply More...
 
local _responseData
 to indecate if the http reqeust is successful simply More...
 
std::vector< char > _responseHeader
 the returned raw data. You can also dump it as a string More...
 
var _responseHeader
 the returned raw data. You can also dump it as a string More...
 
local _responseHeader
 the returned raw data. You can also dump it as a string More...
 
long _responseCode
 the returned raw header data. You can also dump it as a string More...
 
var _responseCode
 the returned raw header data. You can also dump it as a string More...
 
local _responseCode
 the returned raw header data. You can also dump it as a string More...
 
std::string _errorBuffer
 the status code returned from libcurl, e.g. 200, 404 More...
 
var _errorBuffer
 the status code returned from libcurl, e.g. 200, 404 More...
 
local _errorBuffer
 the status code returned from libcurl, e.g. 200, 404 More...
 
- Protected Attributes inherited from Object
unsigned int _reference
 count of references More...
 
var _reference
 count of references More...
 
local _reference
 count of references More...
 
unsigned int _autoReleaseCount
 count of autorelease More...
 
var _autoReleaseCount
 count of autorelease More...
 
local _autoReleaseCount
 count of autorelease More...
 

Additional Inherited Members

- Public Attributes inherited from Object
unsigned int _ID
 object id, ScriptSupport need public _ID More...
 
int _luaID
 Lua reference id. More...
 
var _luaID
 Lua reference id. More...
 
local _luaID
 Lua reference id. More...
 

Detailed Description

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

Since
v2.0.2

Constructor & Destructor Documentation

HttpResponse ( HttpRequest request)
inline

Constructor, it's used by HttpClient internal, users don't need to create HttpResponse manually.

Parameters
requestthe corresponding HttpRequest which leads to this response
var HttpResponse ( var  request)
inline

Constructor, it's used by HttpClient internal, users don't need to create HttpResponse manually.

Parameters
requestthe corresponding HttpRequest which leads to this response
local HttpResponse ( local  request)
inline

Constructor, it's used by HttpClient internal, users don't need to create HttpResponse manually.

Parameters
requestthe corresponding HttpRequest which leads to this response
virtual ~HttpResponse ( )
inlinevirtual

Destructor, it will be called in HttpClient internal, users don't need to desturct HttpResponse object manully.

var ~HttpResponse ( )
inlinevirtual

Destructor, it will be called in HttpClient internal, users don't need to desturct HttpResponse object manully.

local ~HttpResponse ( )
inlinevirtual

Destructor, it will be called in HttpClient internal, users don't need to desturct HttpResponse object manully.

Member Function Documentation

cocos2d::Object* autorelease ( void  )
inline

Override autorelease method to prevent developers from calling it.

var autorelease (   )
inline

Override autorelease method to prevent developers from calling it.

local autorelease (   )
inline

Override autorelease method to prevent developers from calling it.

const char* getErrorBuffer ( )
inline

Get the rror buffer which will tell you more about the reason why http request failed.

var getErrorBuffer ( )
inline

Get the rror buffer which will tell you more about the reason why http request failed.

local getErrorBuffer ( )
inline

Get the rror buffer which will tell you more about the reason why http request failed.

HttpRequest* getHttpRequest ( )
inline

Get the corresponding HttpRequest object which leads to this response There's no paired setter for it, coz it's already setted in class constructor.

var getHttpRequest ( )
inline

Get the corresponding HttpRequest object which leads to this response There's no paired setter for it, coz it's already setted in class constructor.

local getHttpRequest ( )
inline

Get the corresponding HttpRequest object which leads to this response There's no paired setter for it, coz it's already setted in class constructor.

long getResponseCode ( )
inline

Get the http response errorCode I know that you want to see http 200 :)

var getResponseCode ( )
inline

Get the http response errorCode I know that you want to see http 200 :)

local getResponseCode ( )
inline

Get the http response errorCode I know that you want to see http 200 :)

std::vector<char>* getResponseData ( )
inline

Get the http response raw data.

var getResponseData ( )
inline

Get the http response raw data.

local getResponseData ( )
inline

Get the http response raw data.

std::vector<char>
* getResponseHeader
( )
inline

get the Rawheader

var getResponseHeader ( )
inline

get the Rawheader

local getResponseHeader ( )
inline

get the Rawheader

bool initWithRequest ( HttpRequest request)
protected
var initWithRequest ( var  request)
protected
local initWithRequest ( local  request)
protected
bool isSucceed ( )
inline

To see if the http reqeust is returned successfully, Althrough users can judge if (http return code = 200), we want an easier way If this getter returns false, you can call getResponseCode and getErrorBuffer to find more details.

var isSucceed ( )
inline

To see if the http reqeust is returned successfully, Althrough users can judge if (http return code = 200), we want an easier way If this getter returns false, you can call getResponseCode and getErrorBuffer to find more details.

local isSucceed ( )
inline

To see if the http reqeust is returned successfully, Althrough users can judge if (http return code = 200), we want an easier way If this getter returns false, you can call getResponseCode and getErrorBuffer to find more details.

void setErrorBuffer ( const char *  value)
inline

Set the error buffer which will tell you more the reason why http request failed.

var setErrorBuffer ( var  value)
inline

Set the error buffer which will tell you more the reason why http request failed.

local setErrorBuffer ( local  value)
inline

Set the error buffer which will tell you more the reason why http request failed.

void setResponseCode ( long  value)
inline

Set the http response errorCode.

var setResponseCode ( var  value)
inline

Set the http response errorCode.

local setResponseCode ( local  value)
inline

Set the http response errorCode.

void setResponseData ( std::vector< char > *  data)
inline

Set the http response raw buffer, is used by HttpClient.

var setResponseData ( var  data)
inline

Set the http response raw buffer, is used by HttpClient.

local setResponseData ( local  data)
inline

Set the http response raw buffer, is used by HttpClient.

void setResponseHeader ( std::vector< char > *  data)
inline

Set the http response Header raw buffer, is used by HttpClient.

var setResponseHeader ( var  data)
inline

Set the http response Header raw buffer, is used by HttpClient.

local setResponseHeader ( local  data)
inline

Set the http response Header raw buffer, is used by HttpClient.

void setSucceed ( bool  value)
inline

Set if the http request is returned successfully, Althrough users can judge if (http code == 200), we want a easier way This setter is mainly used in HttpClient, users mustn't set it directly.

var setSucceed ( var  value)
inline

Set if the http request is returned successfully, Althrough users can judge if (http code == 200), we want a easier way This setter is mainly used in HttpClient, users mustn't set it directly.

local setSucceed ( local  value)
inline

Set if the http request is returned successfully, Althrough users can judge if (http code == 200), we want a easier way This setter is mainly used in HttpClient, users mustn't set it directly.

Member Data Documentation

std::string _errorBuffer
protected

the status code returned from libcurl, e.g. 200, 404

var _errorBuffer
protected

the status code returned from libcurl, e.g. 200, 404

local _errorBuffer
protected

the status code returned from libcurl, e.g. 200, 404

HttpRequest* _pHttpRequest
protected
var _pHttpRequest
protected
local _pHttpRequest
protected
long _responseCode
protected

the returned raw header data. You can also dump it as a string

var _responseCode
protected

the returned raw header data. You can also dump it as a string

local _responseCode
protected

the returned raw header data. You can also dump it as a string

std::vector<char> _responseData
protected

to indecate if the http reqeust is successful simply

var _responseData
protected

to indecate if the http reqeust is successful simply

local _responseData
protected

to indecate if the http reqeust is successful simply

std::vector<char> _responseHeader
protected

the returned raw data. You can also dump it as a string

var _responseHeader
protected

the returned raw data. You can also dump it as a string

local _responseHeader
protected

the returned raw data. You can also dump it as a string

bool _succeed
protected

the corresponding HttpRequest pointer who leads to this response

var _succeed
protected

the corresponding HttpRequest pointer who leads to this response

local _succeed
protected

the corresponding HttpRequest pointer who leads to this response


The documentation for this class was generated from the following file: