cocos2d-x  2.2.3-gd2.113-rev1ec524e
Loading...
Searching...
No Matches
CCHttpResponse 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 CCHttpResponse:
[legend]
Collaboration diagram for CCHttpResponse:
[legend]

Public Member Functions

 CCHttpResponse (CCHttpRequest *request)
 Constructor, it's used by CCHttpClient internal, users don't need to create HttpResponse manually. More...
 
virtual ~CCHttpResponse ()
 Destructor, it will be called in CCHttpClient internal, users don't need to desturct HttpResponse object manully. More...
 
CCObjectautorelease (void)
 Override autorelease method to prevent developers from calling it. More...
 
CCHttpRequestgetHttpRequest ()
 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...
 
std::vector< char > * getResponseHeader ()
 get the Rawheader More...
 
int 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 CCHttpClient, users mustn't set it directly. More...
 
void setResponseData (std::vector< char > *data)
 Set the http response raw buffer, is used by CCHttpClient. More...
 
void setResponseHeader (std::vector< char > *data)
 Set the http response Header raw buffer, is used by CCHttpClient. More...
 
void setResponseCode (int 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...
 
- Public Member Functions inherited from CCObject
 CCObject (void)
 
virtual ~CCObject (void)
 NA. More...
 
void release (void)
 
void retain (void)
 
CCObjectautorelease (void)
 
CCObjectcopy (void)
 
bool isSingleReference (void) const
 
unsigned int retainCount (void) const
 
virtual bool isEqual (const CCObject *pObject)
 
virtual void acceptVisitor (CCDataVisitor &visitor)
 
virtual void update (float dt)
 
 CCObject (const CCObject &)
 
CCObjectoperator= (const CCObject &)
 
virtual void encodeWithCoder (DS_Dictionary *)
 
virtual bool canEncode ()
 
CCObjectType getObjType () const
 
virtual int getTag () const
 
virtual void setTag (int nTag)
 
void setObjType (CCObjectType)
 
- Public Member Functions inherited from CCCopying
virtual CCObjectcopyWithZone (CCZone *pZone)
 

Protected Member Functions

bool initWithRequest (CCHttpRequest *request)
 

Protected Attributes

CCHttpRequest_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...
 
std::vector< char > _responseHeader
 the returned raw data. You can also dump it as a string More...
 
int _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...
 
- Protected Attributes inherited from CCObject
unsigned int m_uReference
 
unsigned int m_uAutoReleaseCount
 
int m_nTag
 
int m_eObjType
 
unsigned int m_uObjectIdxInArray
 

Additional Inherited Members

- Static Public Member Functions inherited from CCObject
static CCObjectcreateWithCoder (DS_Dictionary *)
 
- Public Attributes inherited from CCObject
unsigned int m_uID
 
int m_nLuaID
 

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 NA NA

Constructor & Destructor Documentation

◆ CCHttpResponse()

CCHttpResponse ( CCHttpRequest request)
inline

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

Parameters
requestthe corresponding HttpRequest which leads to this response

◆ ~CCHttpResponse()

virtual ~CCHttpResponse ( )
inlinevirtual

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

Member Function Documentation

◆ autorelease()

CCObject * autorelease ( void  )
inline

Override autorelease method to prevent developers from calling it.

◆ getErrorBuffer()

const char * getErrorBuffer ( )
inline

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

◆ getHttpRequest()

CCHttpRequest * 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.

◆ getResponseCode()

int getResponseCode ( )
inline

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

◆ getResponseData()

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

Get the http response raw data.

◆ getResponseHeader()

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

get the Rawheader

◆ initWithRequest()

bool initWithRequest ( CCHttpRequest request)
protected

◆ isSucceed()

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.

◆ setErrorBuffer()

void setErrorBuffer ( const char *  value)
inline

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

◆ setResponseCode()

void setResponseCode ( int  value)
inline

Set the http response errorCode.

◆ setResponseData()

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

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

◆ setResponseHeader()

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

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

◆ setSucceed()

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 CCHttpClient, users mustn't set it directly.

Member Data Documentation

◆ _errorBuffer

std::string _errorBuffer
protected

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

◆ _pHttpRequest

CCHttpRequest* _pHttpRequest
protected

◆ _responseCode

int _responseCode
protected

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

◆ _responseData

std::vector<char> _responseData
protected

to indecate if the http reqeust is successful simply

◆ _responseHeader

std::vector<char> _responseHeader
protected

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

◆ _succeed

bool _succeed
protected

the corresponding HttpRequest pointer who leads to this response


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