struct CCL::Web::IXMLHttpRequest

Overview

Nearly W3C-compliant XMLHttpRequest API definition (see http://www.w3.org/TR/XMLHttpRequest/) More…

#include <ixmlhttprequest.h>

struct IXMLHttpRequest: public CCL::IAsyncInfo
{
    // enums

    enum ReadyState;

    // methods

    virtual DECLARE_STRINGID_MEMBER (kOnLoadStart) const = 0;
    virtual IStream*CCL_API getResponseStream () const = 0;
    virtual int CCL_API getStatus () const = 0;
    virtual tresult CCL_API abort () = 0;

    virtual tresult CCL_API open (
        StringID method,
        UrlRef url,
        tbool async = true,
        StringRef user = nullptr,
        StringRef password = nullptr,
        StringRef authType = nullptr
    ) = 0;

    virtual tresult CCL_API setRequestHeader (StringID header, StringID value) = 0;

    virtual tresult CCL_API send (
        VariantRef data = 0,
        IProgressNotify* progress = nullptr
    ) = 0;

    virtual IWebHeaderCollection*CCL_API getAllResponseHeaders () const = 0;
    virtual tresult CCL_API getResponseHeader (CString& result, StringID id) const = 0;
};

Inherited Members

public:
    // enums

    enum State;

    // methods

    virtual tresult CCL_API queryInterface (UIDRef iid, void** ptr) = 0;
    virtual unsigned int CCL_API retain () = 0;
    virtual unsigned int CCL_API release () = 0;
    virtual State CCL_API getState () const = 0;

Detailed Documentation

Nearly W3C-compliant XMLHttpRequest API definition (see http://www.w3.org/TR/XMLHttpRequest/)

Threading Policy: The XMLHttpRequest object itself is not thread-safe. It can be used either in synchronous or asynchronous mode. In synchronous mode no events will be signaled.

Methods

virtual DECLARE_STRINGID_MEMBER (kOnLoadStart) const = 0

< While sending and loading data. (arg[0]: progress value)

< When the request has been aborted. For instance, by invoking the abort() method. < When the request has failed at network level (not application level with HTTP error code) < When the request has successfully completed. < When the request has completed (either in success or failure). < When the readyState property changes Returns the current state [IObject “readyState”].

virtual IStream*CCL_API getResponseStream () const = 0

Represents HTTP response as stream.

virtual int CCL_API getStatus () const = 0

Returns the HTTP status code returned by a request [IObject “status”].

virtual tresult CCL_API abort () = 0

Cancels the current HTTP request.

virtual tresult CCL_API open (
    StringID method,
    UrlRef url,
    tbool async = true,
    StringRef user = nullptr,
    StringRef password = nullptr,
    StringRef authType = nullptr
) = 0

Initializes the request and specifies the method, URL, and authentication information.

virtual tresult CCL_API setRequestHeader (StringID header, StringID value) = 0

Specifies an HTTP request header.

virtual tresult CCL_API send (
    VariantRef data = 0,
    IProgressNotify* progress = nullptr
) = 0

Sends an HTTP request to the server and receives a response.

The progress callback interface can be used for synchronous requests.

virtual IWebHeaderCollection*CCL_API getAllResponseHeaders () const = 0

Returns all headers from the response.

virtual tresult CCL_API getResponseHeader (CString& result, StringID id) const = 0

Returns the header field value from the response of which the field name matches id.