Using the NSAPI Examples

                                                                                                                                                                                                                                                                                                                                      Back to [Book]     [Topic]

Using the NSAPI Examples

The install-dir/samples/nsapi directory contains examples of source code for SAFs.

You can use the example.mak (Windows) or Makefile (UNIX) makefile in the same directory to compile the examples and create shared libraries containing the functions in all of the example files.

To test an example, load the examples shared library into the server by adding the following directive in the Init section of magnus.conf:

Init fn=load-modules 
     shlib=examples.so/dll
     funcs=_function1,...,functionN_     

The shlib parameter specifies the path to the shared library, for example, ../../samples/nsapi/examples.so, and the funcs parameter specifies the functions to load from the shared library.

If the example uses an initialization function, be sure to specify the initialization function in the funcs argument to load-modules. Also, add an Init directive to call the initialization function.

For example, the PathCheck example implements the restrict-by-acf function, which is initialized by the acf-init function. The following directive loads both these functions:

Init fn=load-modules
     shlib="_path_"  
     funcs=acf-init,restrict-by-acf

The following directive calls the acf-init function during server initialization:

Init fn=acf-init file=_extra-arg_

To invoke the new SAF at the appropriate step in the response handling process, add an appropriate directive in the object to which it applies, for example:

PathCheck fn=restrict-by-acf

After adding new Init directives to magnus.conf, restart the Web Server to load the changes. Init directives are only applied during server initialization.

Labels

java java Delete
server server Delete
sun sun Delete
webserver webserver Delete
application application Delete
system system Delete
webtier webtier Delete
guide guide Delete
developers developers Delete
webserver70 webserver70 Delete
developersguide developersguide Delete
sunjava sunjava Delete
nsapi nsapi Delete
nsapidevelopersguide nsapidevelopersguide Delete
web web Delete
+nsapiguide +nsapiguide Delete
nsapiguide nsapiguide Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Sign up or Log in to add a comment or watch this page.


The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright 1994-2009 Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact