Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Internet Protocols Module User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

A.4 Migrating from RWIHttpMethod to RWHttpRequest

RWIHttpMethod is deprecated. RWIHttpMethod and its derived classes were used to specify how a request would be made through an RWIHttpClient. Under HTTP/1.1, the entire RWIHttpMethod hierarchy is replaced with the single class RWHttpRequest, which encapsulates the functionality in RWIHttpMethod, as well as new functionality.

Under the old architecture, a request to GET the root document from the www.roguewave.com Web server would be as follows:

//1

Creates an RWIHttpGet object (derived from RWIHttpMethod) with the path specified as /.

The equivalent code using an RWHttpRequest is:

//1

Creates an RWHttpRequest object with the method type set to GET, and the path set to /.

The new architecture reduces the amount of code you need to write. For example, if you need to use an HTTP method that is not explicitly included in the HTTP/1.0 or HTTP/1.1 classes, you would need to do the following:

  1. Derive and implement a new class from RWIHttpMethod, such as RWIHttpMGet.

  2. Implement the details of RWIHttpMGet to fit the requirements for that request type.

  3. Create an instance of that method.

Under HTTP/1.1, you only specify the new method type as the first argument. For example, to create an M-GET request, your code would look something like this:

//1

Creates an RWHttpRequest with M-GET as the method type and with the path specified as /.

In addition, you can construct an RWHttpRequest object from an RWIHttpMethod object directly. This is useful if you have already created a complex RWIHttpMethod class and do not want to convert all of the code to the RWHttpRequest format. The following example shows how to create a request object from the getMethod object created earlier.

//1

Constructs a new RWHttpRequest object based upon the content of the getMethod object.


The method RWHttpRequest::RWHttpRequest(const RWIHttpMethod& method) is deprecated and is not recommended for future development. It is provided only as a convenience for customers who are trying to convert older code written for HTTP/1.0 classes to the HTTP/1.1 classes.

For more information about RWHttpRequest, see Section 5.3, "Using the HTTP Classes," Section 5.4, "Advanced Topics," and the SourcePro C++ API Reference Guide.



Previous fileTop of DocumentContentsIndex pageNext file

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.