struct CCL::Web::IWebService

Overview

Service interface for web-aware applications. More…

#include <iwebservice.h>

struct IWebService: public CCL::IUnknown
{
    // methods

    virtual tresult CCL_API setUserAgent (StringRef userAgent) = 0;
    virtual IWebClient*CCL_API createClient (StringID protocol) = 0;
    virtual IWebServer*CCL_API createServer (StringID protocol) = 0;
    virtual IWebNewsReader*CCL_API createReader () = 0;
    virtual IWebCredentials*CCL_API createCredentials () = 0;
    virtual IWebHeaderCollection*CCL_API createHeaderCollection () = 0;

    virtual tresult CCL_API downloadData (
        UrlRef remotePath,
        IStream& localStream,
        IWebCredentials* credentials = nullptr,
        IWebHeaderCollection* headers = nullptr,
        IProgressNotify* progress = nullptr,
        int* status = nullptr
    ) = 0;

    virtual tresult CCL_API downloadInBackground (
        IObserver* observer,
        UrlRef remotePath,
        IStream& localStream,
        IWebCredentials* credentials = nullptr,
        IWebHeaderCollection* headers = nullptr
    ) = 0;

    virtual tresult CCL_API uploadData (
        UrlRef remotePath,
        IStream& data,
        IWebHeaderCollection* headers,
        IStream& response,
        StringID method = nullptr,
        IWebCredentials* credentials = nullptr,
        IProgressNotify* progress = nullptr,
        int* status = nullptr
    ) = 0;

    virtual tresult CCL_API uploadInBackground (
        IObserver* observer,
        UrlRef remotePath,
        IStream& localStream,
        IWebHeaderCollection* headers,
        StringID method = nullptr,
        IWebCredentials* credentials = nullptr
    ) = 0;

    virtual tresult CCL_API cancelOperation (IObserver* observer) = 0;
    virtual tresult CCL_API cancelOnExit () = 0;
};

Inherited Members

public:
    // 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;

Detailed Documentation

Service interface for web-aware applications.

Methods

virtual tresult CCL_API setUserAgent (StringRef userAgent) = 0

Set user agent string used in HTTP transactions.

virtual IWebClient*CCL_API createClient (StringID protocol) = 0

Create client instance for given protocol (e.g.

HTTP).

virtual IWebServer*CCL_API createServer (StringID protocol) = 0

Create server instance for given protocol (e.g.

HTTP).

virtual IWebNewsReader*CCL_API createReader () = 0

Create feed reader (Atom/RSS).

virtual IWebCredentials*CCL_API createCredentials () = 0

Create credentials object.

virtual IWebHeaderCollection*CCL_API createHeaderCollection () = 0

Create header collection object.

virtual tresult CCL_API downloadData (
    UrlRef remotePath,
    IStream& localStream,
    IWebCredentials* credentials = nullptr,
    IWebHeaderCollection* headers = nullptr,
    IProgressNotify* progress = nullptr,
    int* status = nullptr
) = 0

Download remote resource to local storage.

Returns result at network level, use status for application level.

virtual tresult CCL_API downloadInBackground (
    IObserver* observer,
    UrlRef remotePath,
    IStream& localStream,
    IWebCredentials* credentials = nullptr,
    IWebHeaderCollection* headers = nullptr
) = 0

Download remote resource asynchronously.

Observer receives kBackgroundProgressNotify + kDownloadComplete messages.

virtual tresult CCL_API uploadData (
    UrlRef remotePath,
    IStream& data,
    IWebHeaderCollection* headers,
    IStream& response,
    StringID method = nullptr,
    IWebCredentials* credentials = nullptr,
    IProgressNotify* progress = nullptr,
    int* status = nullptr
) = 0

Upload data.

Headers must include content type. Returns result at network level, use status for application level.

virtual tresult CCL_API uploadInBackground (
    IObserver* observer,
    UrlRef remotePath,
    IStream& localStream,
    IWebHeaderCollection* headers,
    StringID method = nullptr,
    IWebCredentials* credentials = nullptr
) = 0

Upload data asynchronously.

Headers must include content type. Observer receives kBackgroundProgressNotify + kUploadComplete messages.

virtual tresult CCL_API cancelOperation (IObserver* observer) = 0

Cancel asynchronous upload or download.

virtual tresult CCL_API cancelOnExit () = 0

Mark all asynchronous operations canceled on program exit.

Note that this doesn’t wait for them to be finished so cancelOperation() still needs to be called individually but with the benefit of operations not waiting on each other.