CkHttpRequest C++ Class Reference (Visual C++)
CkHttpRequest
Represents a complete HTTP request.
Properties
void get_Charset(CkString &str); void put_Charset(const char *charset);
Controls the character encoding used for HTTP request parameters for POST requests. The default value is "utf-8". The charset should match the charset expected by the form target.
void get_HttpVersion(CkString &str); void put_HttpVersion(const char *version);
The HTTP version in the request header. Defaults to "1.1".
void LastErrorHtml(CkString &str);
Error information in HTML format for the last method called.
void LastErrorText(CkString &str);
Error information in plain-text format for the last method called.
void LastErrorXml(CkString &str);
Error information in XML format for the last method called.
int get_NumHeaderFields(void);
Returns the number of request header fields.
int get_NumParams(void);
Returns the number of query parameters.
void get_Path(CkString &str); void put_Path(const char *path);
The path of the resource requested. A path of "/" indicates the default document for a domain.
bool get_SendCharset(void); void put_SendCharset(bool val);
Controls whether the charset is explicitly included in the content-type header field of the HTTP POST request.
bool get_Utf8(void) const; void put_Utf8(bool b);
When set to true, all "const char *" arguments are expected to be utf-8 strings. If set to false, the "const char *" arguments are expected to be ANSI strings.
Methods
bool AddFileForUpload(const char * name, const char * filename);
Adds a file to an upload request. To create a file upload request, call UseUpload and then call AddFileForUpload for each file to be uploaded.
void AddHeader(const char * name, const char * value);
Adds a request header to the HTTP request. If a header having the same field name is already present, this method replaces it.
void AddParam(const char * name, const char * value);
Adds a request query parameter (name/value pair) to the HTTP request. The name and value strings passed to this method should not be URL encoded.
void GenerateRequestText(CkString & str);
Returns the request text that would be sent if Http.SynchronousRequest was called. Returns true for success, false for failure.
bool GetHeaderField(const char * name, CkString & str);
Returns the value of a request header field. Returns true for success, false for failure.
bool GetHeaderName(int index, CkString & str);
Returns the Nth request header field name. Indexing begins at 0, and the number of request header fields is specified by the NumHeaderFields property. Returns true for success, false for failure.
bool GetHeaderValue(int index, CkString & str);
Returns the Nth request header field value. Indexing begins at 0, and the number of request header fields is specified by the NumHeaderFields property. Returns true for success, false for failure.
bool GetParam(const char * name, CkString & str);
Returns a request query parameter value by name. Returns true for success, false for failure.
bool GetParamName(int index, CkString & str);
Returns the Nth request query parameter field name. Indexing begins at 0, and the number of request query parameter fields is specified by the NumParams property. Returns true for success, false for failure.
bool GetParamValue(int index, CkString & str);
Returns the Nth request query parameter field value. Indexing begins at 0, and the number of request query parameter fields is specified by the NumParams property. Returns true for success, false for failure.
bool LoadBodyFromBytes(CkByteData & binaryData);
To be documented soon...
bool LoadBodyFromFile(const char * filename);
To be documented soon...
bool LoadBodyFromString(const char * bodyStr);
To be documented soon...
void RemoveAllParams();
Removes all request parameters.
void RemoveParam(const char * name);
Removes a single HTTP request parameter by name.
bool SaveLastError(const char * filename);
Saves the last error information to an XML formatted file.
void SetFromUrl(const char * url);
Parses a URL and sets the Path and query parameters (NumParams, GetParam, GetParamName, GetParamValue).
void UseGet();
Makes the HttpRequest a GET request.
void UseHead();
Makes the HttpRequest a HEAD request.
void UsePost();
Makes the HttpRequest a POST request that uses the "application/x-www-form-urlencoded" content type.
void UseUpload();
Makes the HttpRequest a POST request that uses the "multipart/form-data" content type. To create a file upload request, call UseUpload and then call AddFileForUpload for each file to be uploaded.
void UseXmlHttp(const char * xmlBody);
Makes the HttpRequest a POST request using the "text/xml" content type. The request body is set to the XML string passed to this method.
const char * charset();
Controls the character encoding used for HTTP request parameters for POST requests. The default value is "utf-8". The charset should match the charset expected by the form target.
const char * getHeaderField(const char * name);
Returns the value of a request header field.
const char * getHeaderName(int index);
Returns the Nth request header field name. Indexing begins at 0, and the number of request header fields is specified by the NumHeaderFields property.
const char * getHeaderValue(int index);
Returns the Nth request header field value. Indexing begins at 0, and the number of request header fields is specified by the NumHeaderFields property.
const char * getParam(const char * name);
Returns a request query parameter value by name.
const char * getParamName(int index);
Returns the Nth request query parameter field name. Indexing begins at 0, and the number of request query parameter fields is specified by the NumParams property.
const char * getParamValue(int index);
Returns the Nth request query parameter field value. Indexing begins at 0, and the number of request query parameter fields is specified by the NumParams property.
const char * httpVersion();
The HTTP version in the request header. Defaults to "1.1".
const char * lastErrorHtml();
Error information in HTML format for the last method called.
const char * lastErrorText();
Error information in plain-text format for the last method called.
const char * lastErrorXml();
Error information in XML format for the last method called.
const char * path();
The path of the resource requested. A path of "/" indicates the default document for a domain.
|