SourcePro® 2023.1 |
SourcePro® API Reference Guide |
Provides a low-level interface for communicating with an HTTP server. More...
#include <rw/http/RWHttpClient.h>
Public Member Functions | |
RWHttpClient (void) | |
RWHttpClient (const RWHttpClient &client) | |
virtual | ~RWHttpClient () |
void | connect (const RWSockAddrBase &address, unsigned long maxwait=0) |
RWHttpReply | getReply (unsigned long maxwait=0) |
RWHttpReply | getReply (RWTFunctor< void(RWPortal)> handler, unsigned long maxwait=0) |
RWHttpReply | getReply (RWTFunctor< void(RWPortal, RWHttpReply &)> handler, unsigned long maxwait=0) |
bool | isConnected () const |
RWHttpClient & | operator= (const RWHttpClient &other) |
bool | submit (RWHttpRequest request, RWHttpPipeline pl=RW_HTTP_FORBID_PIPELINING, unsigned long maxwait=0) |
Public Member Functions inherited from RWHandleBase | |
bool | isValid (void) const |
bool | operator!= (const RWHandleBase &second) const |
bool | operator< (const RWHandleBase &second) const |
bool | operator== (const RWHandleBase &second) const |
Protected Member Functions | |
RWHttpClient (RWHttpClientImp *imp) | |
RWHttpClientImp & | body () const |
Protected Member Functions inherited from RWHandleBase | |
RWHandleBase (void) | |
RWHandleBase (RWStaticCtor) | |
RWHandleBase (RWBodyBase *body) | |
RWHandleBase (const RWHandleBase &second) | |
~RWHandleBase (void) | |
RWBodyBase & | body (void) const |
RWHandleBase & | operator= (const RWHandleBase &second) |
RWHttpClient enables detailed control over HTTP communications. The asynchronous nature of HTTP/1.1 enables you to submit multiple requests to the server before retrieving any of the replies. Replies are returned in the same order that they are submitted.
RWHttpClient objects are lightweight. They are implemented using the handle-body pattern. The RWHttpClient is a handle to an implementation that performs the protocol interaction.
|
inlineprotected |
Protected constructor from imp.
|
inline |
Constructs a default RWHttpClient object.
|
inline |
Copy constructor. The body of the new client is the same as client.
|
virtual |
Virtual destructor.
|
inlineprotected |
Returns a reference to the body.
|
inline |
Enables an HTTP client to establish a connection session with an HTTP server. The address argument specifies the address of the server to connect to.
The optional value maxwait specifies how long the RWHttpClient waits for data to become available on a socket before deciding that the socket is dead. maxwait defaults to 0
, which specifies that RWHttpClient waits indefinitely for data. If the maxwait time expires, an RWNetOperationTimeoutError exception is thrown.
|
inline |
Returns the next response from the server. The response contains the status code and headers, plus the body of the response as an RWCString.
The optional value maxwait is the number of milliseconds that the RWHttpClient waits for data to become available on a socket before deciding that the socket is dead. maxwait defaults to 0
, which specifies that RWHttpClient waits indefinitely for data. If the maxwait time expires, an RWNetOperationTimeoutError exception is thrown.
|
inline |
Returns the next reply from the server. The reply contains the status code and headers for the reply. A portal containing the body of the message is passed to the user-defined handler. If the message is not read fully from the portal by the handler, an RWHttpHandlerError exception is thrown.
The optional value maxwait is the number of milliseconds that the RWHttpClient waits for data to become available on a socket before deciding that the socket is dead. maxwait defaults to 0
, which specifies that RWHttpClient waits indefinitely for data. If the maxwait time expires, an RWNetOperationTimeoutError exception is thrown.
|
inline |
Equivalent to getReply(RWTFunctor<void(RWPortal)>, unsigned long), however this method also receives a reference to the RWHttpReply instance that is returned when the function completes. This method allows the user to access the headers and status of the message while processing the body.
|
inline |
Returns true
if the client was last known to be connected to an HTTP server. Otherwise returns false
.
A return of true
does not guarantee that the client is currently connected to the server. true
indicates only the state of the connection after the last read or write attempt. For example, if the server silently closed the connection, this function returns true
.
|
inline |
Assigns the body of other to this
. Any previous bodies associated with this RWHttpClient object are released.
|
inline |
Returns true
if it successfully submits a request to the server. Otherwise returns false
. If pl is equal to RW_HTTP_ALLOW_PIPELINING, the client assumes that it is safe to pipeline the request. For information about pipelining, see the Internet Protocols Module User's Guide.
The optional value maxwait is the number of milliseconds that the RWHttpClient waits for data to become available on a socket before deciding that the socket is dead. maxwait defaults to 0
, which specifies that RWHttpClient waits indefinitely for data. If the maxwait time expires, an RWNetOperationTimeoutError exception is thrown.
Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved. |