RWIHttpClient is deprecated and has been replaced by RWHttpClient. Changes were necessary to take advantage of new features in HTTP/1.1:
The RWIHttpVersion class is no longer necessary. Information concerning how a request should be sent is stored in the RWHttpRequest class, not in the client itself.
Executing a request is a two-step process. RWIHttpClient sends a request and retrieves the reply using a single member function. RWHttpClient splits the function into two member functions.
RWIHttpClient returns an RWIHttpReply instance wrapped in an IOU, and automatically spawns a thread in order to execute the request. RWHttpClient is no longer multithread-hot, so the IOU is no longer in the return. This adds flexibility in determining when RWHttpClient requests need their own threads and how those threads are organized.
The following examples show a request for the root document of the www.roguewave.com Web server using RWIHttpClient and RWHttpClient. They are simple, but will help you to convert larger requests to the RWHttpClient.
RWIHttpVersion_1_0 httpVersion; RWIHttpClient client(httpVersion); RWTIOUResult<RWIHttpReply> iouReply; client.connect("www.roguewave.com"); RWIHttpGet getRequest("/"); iouReply = client.execute(getRequest); RWIHttpReply reply = iouReply.redeem(); RWSocketPortal portal = reply.portal(); RWCString body, temp; while (!(temp = portal.recv()).isNull()) body += temp; |
RWHttpClient client = RWHttpSocketClient::make(); client.connect("www.roguewave.com"); RWHttpRequest getRequest(RWHttpRequest::Get, "/"); client.submit(getRequest); RWHttpReply reply = client.getReply(); RWCString body = reply.getBody(); |
For more information about RWHttpClient, see Section 5.3, "Using the HTTP Classes," Section 5.4, "Advanced Topics," and the SourcePro C++ API Reference Guide.
Copyright © Rogue Wave Software, Inc. All Rights Reserved.
The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.