SourcePro® 2021.1 |
SourcePro® API Reference Guide |
Product Documentation: SourcePro Documentation Home |
Provides a high-level interface for issuing HTTP requests using a cache of connected RWHttpClient instances. More...
#include <rw/http/RWHttpClientManager.h>
Public Types | |
typedef RWTCountingPointer< RWHttpClientManager, RWAtomicCounter > | PointerType |
Public Member Functions | |
RWHttpClientManager () | |
RWHttpClientManager (size_t maxConnections, size_t maxThreads) | |
void | closeIfNotUsedSince (const RWHttpDate &date) |
size_t | getMaxConnectionsPerHost () const |
size_t | getMaxThreads () const |
bool | registerScheme (const RWCString &scheme, RWTFunctor< RWHttpClient()> functor) |
void | setMaxConnectionsPerHost (size_t maxConn) |
void | setMaxThreads (size_t maxThreads) |
bool | unregisterScheme (const RWCString &scheme) |
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.
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.
void RWHttpClientManager::closeIfNotUsedSince | ( | const RWHttpDate & | date | ) |
Closes all connections that not have not been used since date.
|
inline |
Returns the value for the maximum number of clients allowed to connect to a host.
|
inline |
Returns the value for the maximum number of threads that can be created by the client manager.
|
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".
|
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.
|
inline |
Sets the maximum number of threads that can be created by the client manager.
|
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
.
Copyright © 2021 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |