DiCE API nvidia_logo_transpbg.gif Up
mi::http::IRequest Class Referenceabstract

This interface holds all the parameters of a request. More...

#include <http.h>

Public Member Functions

virtual const char * get_request_line () const =0
 Returns the request line of the request. More...
 
virtual const char * get_command () const =0
 Returns the command of the request. More...
 
virtual const char * get_protocol () const =0
 Returns the protocol of the request. More...
 
virtual void set_url (const char *url)=0
 Sets the URL of the request. More...
 
virtual const char * get_url () const =0
 Returns the URL of the request. More...
 
virtual void set_header (const char *key, const char *value)=0
 Changes an existing header of the request or adds a new header to the request. More...
 
virtual void remove_header (const char *key)=0
 Removes a header from the request. More...
 
virtual const char * get_header (const char *key) const =0
 Returns a header from the request. More...
 
virtual bool get_header (Size index, const char **key_pointer, const char **value_pointer) const =0
 Returns the header with the given index. More...
 
virtual void set_argument (const char *key, const char *value)=0
 Changes an argument of the request or adds an argument to the request. More...
 
virtual void add_argument (const char *key, const char *value)=0
 Adds an argument to the request. More...
 
virtual void remove_argument (const char *key)=0
 Removes an argument from the request. More...
 
virtual const char * get_argument (const char *key) const =0
 Returns an argument from the request. More...
 
virtual bool get_argument (Size index, const char **key_pointer, const char **value_pointer) const =0
 Returns the argument with the given index. More...
 
virtual const char * get_body () const =0
 Returns the body string. More...
 

Detailed Description

This interface holds all the parameters of a request.

Note
A pointer to an mi::http::IRequest interface is only valid as long as the mi::http::IConnection interface from which it was obtained is valid. The same is true for all strings obtained from the request. Overwriting such a string using the supplied functions will invalidate the obtained string.
This interface is not derived from mi::base::IInterface. As one consequence, there are no retain() and release() methods, and the interface cannot be used together with the mi::base::Handle class.

Member Function Documentation

 add_argument()

virtual void mi::http::IRequest::add_argument ( const char *  key,
const char *  value 
)
pure virtual

Adds an argument to the request.

This method does not overwrite an argument with the same key but always adds a new one.

Parameters
keyThe key of the argument.
valueThe value of the argument.

 get_argument() [1/2]

virtual const char * mi::http::IRequest::get_argument ( const char *  key) const
pure virtual

Returns an argument from the request.

Note that multiple arguments with the same key can occur in a request and this method will only return the first of them. Consider using get_argument(Size,const char**, const char**) if all arguments matching a particular key are desired.

Parameters
keyThe key of the argument.

 get_argument() [2/2]

virtual bool mi::http::IRequest::get_argument ( Size  index,
const char **  key_pointer,
const char **  value_pointer 
) const
pure virtual

Returns the argument with the given index.

Can be used for iterating over all arguments by starting with index equal to 0 and then incrementing until false is returned. When false is returned, key_pointer and value_pointer will not be written.

Parameters
indexThe index of the argument.
[out]key_pointerA pointer to the argument's key.
[out]value_pointerA pointer to the argument's value.
Returns
true, if there is a header for given index, false otherwise.

 get_body()

virtual const char * mi::http::IRequest::get_body ( ) const
pure virtual

Returns the body string.

Returns
The body, or NULL if there is no body.

 get_command()

virtual const char * mi::http::IRequest::get_command ( ) const
pure virtual

Returns the command of the request.

 get_header() [1/2]

virtual const char * mi::http::IRequest::get_header ( const char *  key) const
pure virtual

Returns a header from the request.

Parameters
keyThe key of the header.
Returns
The value of the header, or NULL if the header was not found.

 get_header() [2/2]

virtual bool mi::http::IRequest::get_header ( Size  index,
const char **  key_pointer,
const char **  value_pointer 
) const
pure virtual

Returns the header with the given index.

Can be used for iterating over all headers by starting with index equal to 0 and then incrementing index until false is returned. When false is returned, key_pointer and value_pointer will not be written.

Parameters
indexThe index of the header.
[out]key_pointerA pointer to the header's key.
[out]value_pointerA pointer to the header's value.
Returns
true, if there is a header for given index, false otherwise.

 get_protocol()

virtual const char * mi::http::IRequest::get_protocol ( ) const
pure virtual

Returns the protocol of the request.

 get_request_line()

virtual const char * mi::http::IRequest::get_request_line ( ) const
pure virtual

Returns the request line of the request.

 get_url()

virtual const char * mi::http::IRequest::get_url ( ) const
pure virtual

Returns the URL of the request.

 remove_argument()

virtual void mi::http::IRequest::remove_argument ( const char *  key)
pure virtual

Removes an argument from the request.

This method removes all arguments with the given key.

Parameters
keyThe key of the argument.

 remove_header()

virtual void mi::http::IRequest::remove_header ( const char *  key)
pure virtual

Removes a header from the request.

Parameters
keyThe key of the header.

 set_argument()

virtual void mi::http::IRequest::set_argument ( const char *  key,
const char *  value 
)
pure virtual

Changes an argument of the request or adds an argument to the request.

If one or more arguments with the same key are present the first argument with this key will be changed.

Parameters
keyThe key of the argument.
valueThe value of the argument.

 set_header()

virtual void mi::http::IRequest::set_header ( const char *  key,
const char *  value 
)
pure virtual

Changes an existing header of the request or adds a new header to the request.

Parameters
keyThe key of the header.
valueThe value of the header.

 set_url()

virtual void mi::http::IRequest::set_url ( const char *  url)
pure virtual

Sets the URL of the request.

Parameters
urlThe new URL to be set.