rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWHttpRequest Class Reference
[HTTP]

Encapsulates an entire HTTP request including the request line, header list, and request body. More...

#include <rw/http/RWHttpRequest.h>

List of all members.

Public Member Functions

 RWHttpRequest ()
 RWHttpRequest (const RWCString &method, const RWCString &path, const RWHttpHeaderList &headers=RWHttpHeaderList(), const RWHttpRequestBody &body=RWHttpRequestStringBody())
 RWHttpRequest (const RWHttpRequest &request)
RWHttpRequestoperator= (const RWHttpRequest &request)
bool isValid () const
void setPath (const RWCString &path)
RWCString getPath () const
RWCString requestLine (void) const
void setHeaders (const RWHttpHeaderList &headerList)
RWHttpHeaderList getHeaders () const
void setBody (const RWHttpRequestBody &body)
RWHttpRequestBodygetBody (void) const
void setVersion (int majorVersion, int minorVersion)
int getMajorVersion (void) const
int getMinorVersion (void) const
void setMethod (const RWCString &method)
RWCString getMethod (void) const

Detailed Description

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.


Constructor & Destructor Documentation

RWHttpRequest::RWHttpRequest (  ) 

Constructs a default RWHttpRequest.

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::RWHttpRequest ( const RWHttpRequest request  ) 

Copy constructor.


Member Function Documentation

RWHttpRequestBody & RWHttpRequest::getBody ( void   )  const [inline]

Returns a reference to the internal body object. This method can be used to retrieve the body associated with the request object.

RWHttpHeaderList RWHttpRequest::getHeaders (  )  const [inline]

Return the list of headers associated with self.

int RWHttpRequest::getMajorVersion ( void   )  const [inline]

Returns the major portion of the HTTP version. The default value is 1.

RWCString RWHttpRequest::getMethod ( void   )  const [inline]

Returns the request type, such as GET. The RWCString should contain 7-bit US-ASCII data.

int RWHttpRequest::getMinorVersion ( void   )  const [inline]

Returns the minor portion of the HTTP version. The default value is 1.

RWCString RWHttpRequest::getPath (  )  const [inline]

Returns the path associated with the RWHttpRequest. The RWCString should contain 7-bit US-ASCII data.

bool RWHttpRequest::isValid ( void   )  const [inline]

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.

RWHttpRequest& RWHttpRequest::operator= ( const RWHttpRequest request  ) 

Assignment operator.

RWCString RWHttpRequest::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 RWHttpRequest::setBody ( const RWHttpRequestBody body  )  [inline]

Sets the internal body of the request to body.

void RWHttpRequest::setHeaders ( const RWHttpHeaderList headerList  )  [inline]

Sets the internal list of headers to headerList.

void RWHttpRequest::setMethod ( const RWCString method  )  [inline]

Sets the request type, such as GET. The RWCString should contain 7-bit US-ASCII data.

void RWHttpRequest::setPath ( const RWCString path  )  [inline]

Sets the target path of the RWHttpRequest to path. The RWCString should contain 7-bit US-ASCII data.

void RWHttpRequest::setVersion ( int  majorVersion,
int  minorVersion 
) [inline]

Sets the internal HTTP version that is used in the request. The default version is 1.1.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© 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.