Installing the Example
To load the shared object containing your functions add the following line in the
section of the
Init
magnus.conf
Init fn=load-modules shlib=
funcs=simple-service-init,simple-service
To call the
simple-service-init
the generated output, add the following line to the
(This line must come after the one that loads the library containing
simple-service-init
Init fn=simple-service-init
generated-output="<H1>
To execute the custom SAF during the request-response process for some object,
add the following line to that object in the
Service type="text/html" fn=simple-service
The
type="text/html"
the
stage only if the
Service
Source Code
#include <nsapi.h>
static char *simple_msg = "default customized content";
/* This is the initialization function.
* It gets the value of the generated-output parameter
* specified in the Init directive in magnus.conf
*/
NSAPI_PUBLIC int init-simple-service(pblock *pb, Session *sn,
Request *rq)
{
/* Get the message from the parameter in the directive in
file:
yourlibrary
function to initialize the message representing
).
Generated output msg
obj.conf
argument indicates that this function is invoked during
content-type
section in
Init
</H1>"
file:
has been set to
text/html
Chapter 6
Examples of Custom SAFs
Service Example
.
magnus.conf
.
225