You.i Engine
CYIHTTPService Class Reference

#include <network/YiHTTPService.h>

Inheritance diagram for CYIHTTPService:

Public Member Functions

 ~CYIHTTPService ()
 
void SetMaxRedirects (uint32_t uMaxRedirects)
 
void SetNetworkTimeoutMs (uint32_t uNetworkTimeoutMs)
 
void SetConnectionTimeoutMs (uint32_t uConnectionTimeoutMs)
 
void SetMaxConcurrentConnections (uint32_t uMaxConnections)
 
void SetNetworkConfiguration (const CYINetworkConfiguration &networkConfiguration)
 
void SetProxyUrl (const CYIUrl &proxyUrl)
 
void Start ()
 
void Start (const CYINetworkConfiguration &networkConfiguration)
 
void Stop ()
 
std::shared_ptr< CYIHTTPResponseEnqueueRequest (const std::shared_ptr< CYIHTTPRequest > &pRequest)
 
void CancelRequest (const std::shared_ptr< CYIHTTPRequest > &pRequest)
 
void LogCacheItems () const
 
void ClearCache ()
 
- Public Member Functions inherited from CYISignalHandler
 CYISignalHandler ()
 
 CYISignalHandler (const CYISignalHandler &rSignalHandler)
 
virtual ~CYISignalHandler ()
 
CYISignalHandleroperator= (const CYISignalHandler &rSignalHandler)
 
void MoveToThread (CYIThread *pThread)
 This function allows the user to override the default thread affinity to any CYIThread that may or may not be running. More...
 
CYIThreadHandle GetThreadAffinity () const
 
void SetThreadAffinity (const CYIThreadHandle &rThreadAffinity)
 
virtual bool IsConnected () const
 
virtual bool IsConnected (const CYISignalBase &rSignal) const
 
void Disconnect (CYISignalBase &rSignal)
 
void DisconnectFromAllSignals ()
 
- Public Member Functions inherited from CYIThread::Listener
 Listener ()
 
virtual ~Listener ()
 
virtual void OnThreadStarted (CYIThread *)
 
virtual void OnThreadTerminated (CYIThread *)
 
virtual void OnThreadFinished (CYIThread *)
 
- Public Member Functions inherited from CYIScriptableObject
 CYIScriptableObject ()
 
 CYIScriptableObject (const CYIScriptableObject &other)
 
CYIScriptableObjectoperator= (const CYIScriptableObject &other)
 
virtual ~CYIScriptableObject ()
 
CYIBindingImplementationGetBindingImplementation () const
 
void SetBindingImplementation (CYIBindingImplementation *pBindingImplementation)
 
virtual const CYIRuntimeTypeInfoGetRuntimeTypeInfoForScriptObject () const
 

Static Public Member Functions

static CYIHTTPServiceGetInstance ()
 
static void SetSSLRootCertificate (const CYIString &rPath)
 

Public Attributes

CYISignal ServiceActive
 
CYISignal ServiceInactive
 

Friends

class CYIHTTPServicePriv
 

Constructor & Destructor Documentation

CYIHTTPService::~CYIHTTPService ( )

Member Function Documentation

void CYIHTTPService::CancelRequest ( const std::shared_ptr< CYIHTTPRequest > &  pRequest)

Cancels the previously enqueued HTTP request.

void CYIHTTPService::ClearCache ( )

Clears all cached responses.

std::shared_ptr<CYIHTTPResponse> CYIHTTPService::EnqueueRequest ( const std::shared_ptr< CYIHTTPRequest > &  pRequest)

Queues an HTTP Request for async processing. The result will be stored in the returned HTTP response when available.

Connect to NotifyResponse and NotifyError on pRequest to be notified when the response is ready, or the request failed.

Query the status of the response using the returned CYIHTTPResponse.

See also
CYIHTTPRequest
CYIHTTPResponse
static CYIHTTPService* CYIHTTPService::GetInstance ( )
static
void CYIHTTPService::LogCacheItems ( ) const

Logs information about cached responses.

void CYIHTTPService::SetConnectionTimeoutMs ( uint32_t  uConnectionTimeoutMs)

Sets the maximum amount of time, in milliseconds, which the connection phase for a request may take. This is the time from when the request is dequeued and the transfer has started to when a response is received from the server.

Default is 30 seconds.

Note
All requests will use this timeout by default, to override on a per request basis use CYIHTTPRequest::SetConnectionTimeout().
void CYIHTTPService::SetMaxConcurrentConnections ( uint32_t  uMaxConnections)

Sets the maximum number of requests that can be active concurrently. Once the maximum is reached requests will remain in a queue until a request completes.

Note
Default maxinmum concurrent connection may vary per platform and setting this to std::numeric_limits<uint32_t>::max() will restore the default
void CYIHTTPService::SetMaxRedirects ( uint32_t  uMaxRedirects)

Sets the max number of redirects which the HTTP service will follow.

Default is 3.

void CYIHTTPService::SetNetworkConfiguration ( const CYINetworkConfiguration networkConfiguration)

Sets or modifies the network configuration settings. networkConfiguration allows you to to configure the underlying caches.

Modifying the network configuration after Start() has been called will only affect cache settings.

void CYIHTTPService::SetNetworkTimeoutMs ( uint32_t  uNetworkTimeoutMs)

Sets the maximum amount of time, in milliseconds, which a request may take. This is the time from when the request is dequeued and the transfer has started to when the transfer is complete.

Default is 60 seconds.

Note
All requests will use this timeout by default, to override on a per request basis use CYIHTTPRequest::SetNetworkTimeout().
void CYIHTTPService::SetProxyUrl ( const CYIUrl proxyUrl)

Set the proxy that will be used for future HTTP requests. Setting the proxy url to an empty url will reset the proxy to use the system settings.

Note
This API is intended for development/debugging purposes.
Warning
This API has no affect on Apple platforms (iOS, OSX, and tvOS). A proxy can still be used by changing the system proxy settings on those platforms.
static void CYIHTTPService::SetSSLRootCertificate ( const CYIString rPath)
static

Set the SSL root certificate for the network.

void CYIHTTPService::Start ( )

Starts the service using the NetworkConfiguration provided by calling SetNetworkConfiguration().

Calling Start() before first calling SetNetworkConfiguration() will result in CYIHTTPService starting with default values for CYINetworkConfiguration::CYINetworkConfiguration. A default persistent cache will be created using the default data path if no cache path is provided.

The service does not accept requests until Start has been called.

Warning
A default persistent cache will not be created if this function is called before CYIApp::UserInit and no cache path is provided.
See also
CYINetworkConfiguration
void CYIHTTPService::Start ( const CYINetworkConfiguration networkConfiguration)

Start the service with the provided configuration settings. rNetworkConfiguration allows you to configure the underlying caches. A default persistent cache will be created using the default data path if no cache path is provided.

The service does not accept requests until Start has been called.

Warning
A default persistent cache will not be created if this function is called before CYIApp::UserInit and no cache path is provided.
See also
CYINetworkConfiguration
void CYIHTTPService::Stop ( )

Stop the service. This is a destructive operation, and Start cannot be called to re-start the service.

The service does not accept requests once Stop has been called.

Friends And Related Function Documentation

friend class CYIHTTPServicePriv
friend

Member Data Documentation

CYISignal CYIHTTPService::ServiceActive

Emitted when the service starts processing requests after a period of inactivity.

See also
ServiceInactive
CYISignal CYIHTTPService::ServiceInactive

Emitted when the service has finished processing all queued requests.

See also
ServiceActive

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