rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWHttpClientManager Class Reference
[HTTP]

Provides a high-level interface for issuing HTTP requests using a cache of connected RWHttpClient instances. More...

#include <rw/http/RWHttpClientManager.h>

List of all members.

Public Types

typedef RWTCountingPointer
< RWHttpClientManager,
RWAtomicCounter
PointerType

Public Member Functions

 RWHttpClientManager ()
 RWHttpClientManager (size_t maxConnections, size_t maxThreads)
void setMaxThreads (size_t maxThreads)
size_t getMaxThreads () const
void setMaxConnectionsPerHost (size_t maxConn)
size_t getMaxConnectionsPerHost () const
void closeIfNotUsedSince (const RWHttpDate &date)
bool registerScheme (const RWCString &scheme, RWTFunctorR0< RWHttpClient > functor)
bool unregisterScheme (const RWCString &scheme)

Detailed Description

RWHttpClientManager provides a resource for pooling connection requests for RWHttpAgent. The RWHttpClientManager is thread-hot, allowing for multiple requests to be processed simultaneously.

Additionally, RWHttpClientManager provides a mechanism for reusing connected clients for multiple requests to the same host.


Member Typedef Documentation

 


Constructor & Destructor Documentation

RWHttpClientManager::RWHttpClientManager (  ) 

Constructs a default RWHttpClientManager. The client manager maintains a pool of 20 threads for executing HTTP requests, and allows a maximum of 2 connections to any host (as recommended by the HTTP specification).

RWHttpClientManager::RWHttpClientManager ( size_t  maxConnections,
size_t  maxThreads 
)

Constructs an RWHttpClientManager instance with a pool containing maxThreads threads, and with a limit of maxConnections connections to any host. A maxConnections value of 0 indicates that there is no limit on the number of connections.


Member Function Documentation

void RWHttpClientManager::closeIfNotUsedSince ( const RWHttpDate date  ) 

Closes all connections that not have not been used since date.

size_t RWHttpClientManager::getMaxConnectionsPerHost (  )  const [inline]

Returns the value for the maximum number of clients allowed to connect to a host.

Note:
This value represents the target maximum number of connections per host, not the current number of connections. See the setMaxConnectionsPerHost() method for details on when these values may differ.
size_t RWHttpClientManager::getMaxThreads (  )  const [inline]

Returns the value for the maximum number of threads that can be created by the client manager.

Note:
This value represents the target maximum number of threads, not the current number of threads in the system. See the setMaxThreads() method for details on when these values may differ.
bool RWHttpClientManager::registerScheme ( const RWCString scheme,
RWTFunctorR0< RWHttpClient functor 
) [inline]

Registers a new URL scheme with the client manager. The functor object functor should return an RWHttpClient instance that can correctly handle requests of the associated scheme.

If the specified scheme has already been registered with this instance, the new functor is ignored the method returns false; otherwise, the method returns true.

By default, the only scheme registered with an RWHttpClientManager is "http".

void RWHttpClientManager::setMaxConnectionsPerHost ( size_t  maxConn  )  [inline]

Sets the maximum number of clients allowed to connect to a host. If maxConn is set to 0, there is no limit on the number of connections.

Note:
If the number of connections is being reduced, the actual number of connections may not decrease immediately if the clients are actively being used. Once a request completes, its connection will be released if the number of connections in the manager is greater than maxConn.
void RWHttpClientManager::setMaxThreads ( size_t  maxThreads  )  [inline]

Sets the maximum number of threads that can be created by the client manager.

Note:
If the number of threads is being reduced, the actual thread count may not decrease immediately if the threads are actively executing requests. Once a request completes, its thread will be released if the number of threads in the manager is greater than maxThreads.
bool RWHttpClientManager::unregisterScheme ( const RWCString scheme  )  [inline]

Unregisters the specified URL scheme from the client manager. If the specified scheme is not registered with the client manager instance, the method returns false; otherwise, the scheme is removed and the method returns true.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.