Barracuda Application Server C/C++ Reference
NO
HttpParameter Struct Reference

Detailed Description

A persistent container object for HTTP parameters.

The parameters in an HttpRequest object are valid only for the duration of the call. The HttpParameter is a container object for the parameters. One can clone the parameters in the request object and save the parameters in an HttpParameter object.

C example:

HttpParameter_clone(
baMalloc(HttpParameter_calculateSize(request)),
request);
if(param)
//OK
else
// baMalloc failed
void * baMalloc(size_t size)
Returns pointer to uninitialized newly-allocated space for an object of size "size",...
A persistent container object for HTTP parameters.
Definition: HttpServer.h:357

C++ example:

request);
if(param)
//OK
else
// baMalloc failed
static U32 calculateSize(struct HttpRequest *req)
Calculate the HttpParameter size.
Definition: HttpServer.h:395
static HttpParameter * clone(void *buf, struct HttpRequest *req)
Copy HTTP parameters to buf and return as a HttpParameter object.
Definition: HttpServer.h:397

All parameters are contained within one memory unit and one can simply call baFree(param) when the object is no longer needed.

You use the HttpParameterIterator for iterating the elements in the object.

C example:

HttpParameter_clone(baMalloc(HttpParameter_calculateSize(req)), req);
if(param)
{
HttpParameterIterator_constructor2(&i, param);
for(;
HttpParameterIterator_hasMoreElements(&i) ;
HttpParameterIterator_nextElement(&i))
{
HttpTrace_printf(0,"Param: %s = %s\n", i.name, i.value);
}
baFree(param);
}
void baFree(void *p)
Deallocates space to which it points.
The HttpParameterIterator is used for iterating through the form elements parsed by the HttpServer ob...
Definition: HttpServer.h:432

C++ Example: See HttpParameterIterator.

#include <HttpServer.h>

Public Member Functions

const char * getParameter (const char *paramName)
 Returns the value of a request parameter as a const char*, or null if the parameter does not exist. More...
 

Static Public Member Functions

static U32 calculateSize (struct HttpRequest *req)
 Calculate the HttpParameter size.
 
static HttpParameterclone (void *buf, struct HttpRequest *req)
 Copy HTTP parameters to buf and return as a HttpParameter object.
 

Member Function Documentation

◆ getParameter()

const char * HttpParameter::getParameter ( const char *  paramName)

Returns the value of a request parameter as a const char*, or null if the parameter does not exist.

Request parameters are extra information sent with the request, which are contained in the query string or posted form data.

If you use this method with a multivalued parameter, the value returned is equal to the first value in a HttpParameterIterator.