Module: Internet Protocols Module Package: HTTP
Does not inherit
getBody() getHeaders() getMajorVersion() getMethod() |
getMinorVersion() getPath() isValid() operator=() |
requestLine() RWHttpRequest() setBody() setHeaders() |
setMethod() setPath() setVersion() |
#include <rw/http/RWHttpRequest.h>
Class RWHttpRequest defines the HTTP request methods in the HTTP specifications. For HTTP/1.1, the commands GET, POST, HEAD, PUT, DELETE, TRACE, and OPTIONS are supported. Class RWHttpRequest enables you to construct a full request and add header information to a request.
RWHttpRequest();
Constructs a default RWHttpRequest.
RWHttpRequest(const RWCString& method, const RWCString& path, const RWHttpHeaderList& headers = RWHttpHeaderList(), const RWHttpRequestBody& body = RWHttpRequestStringBody());
Accepts the method, path, headers, and body for the request. Both a method and path are required, but a header list and body are optional. The RWCString should contain 7-bit US-ASCII data.
NOTE -- Some methods require a body. If one of those methods is invoked without a body, no error is reported by the HTTP package, but an error should be returned from the server.
RWHttpRequest(const RWHttpRequest& request);
Copy constructor.
RWHttpRequest& operator=(const RWHttpRequest& request);
Assignment operator.
RWHttpRequestBody& getBody(void) const;
Returns a reference to the internal body object. This method can be used to retrieve the body associated with the request object.
RWHttpHeaderList getHeaders() const;
Return the list of headers associated with self.
int getMajorVersion(void) const;
Returns the major portion of the HTTP version. The default value is 1.
RWCString getMethod(void) const;
Returns the request type, such as GET. The RWCString should contain 7-bit US-ASCII data.
int getMinorVersion(void) const;
Returns the minor portion of the HTTP version. The default value is 1.
RWCString getPath() const;
Returns the path associated with the RWHttpRequest. The RWCString should contain 7-bit US-ASCII data.
bool isValid() const;
Returns true if this is a valid RWHttpRequest object. Otherwise returns false. To be valid, the object must have a method verb and URI associated with it, and the body of the object must be valid.
RWCString requestLine(void) const;
Returns a string representing the Request-Line for this request. It is similar to GET / HTTP/1.1. The RWCString should contain 7-bit US-ASCII data.
void setBody(const RWHttpRequestBody& body);
Sets the internal body of the request to body.
void setHeaders(const RWHttpHeaderList& headerList);
Sets the internal list of headers to headerList.
void setMethod(const RWCString& method);
Sets the request type, such as GET. The RWCString should contain 7-bit US-ASCII data.
void setPath(const RWCString& path);
Sets the target path of the RWHttpRequest to path. The RWCString should contain 7-bit US-ASCII data.
void setVersion(int majorVersion, int minorVersion);
Sets the internal HTTP version that is used in the request. The default version is 1.1.
© 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.