Next, add directives to obj.conf to instruct the server to call each custom SAF at the appropriate time. The syntax for directives is:
Directive fn=function-name [name1="value1"]...[nameN="valueN"]
Directive is one of the server directives, such as AuthTrans, Service, and so on.
function-name is the name of the SAF to execute.
nameN="valueN" are the names and values of parameters which are passed to the SAF.
Depending on what your new SAF does, you might need to add just one directive to obj.conf, or you might need to add more than one directive to provide complete instructions for invoking the new SAF.
For example, if you define a new AuthTrans or PathCheck SAF, you could just add an appropriate directive in the default object. However, if you define a new Service SAF to be invoked only when the requested resource is in a particular directory or has a new kind of file extension, you would need to take extra steps.
If your new Service SAF is to be invoked only when the requested resource has a new kind of file extension, you might need to add an entry to the MIME types file so that the type value gets set properly during the ObjectType stage. Then you could add a Service directive to the default object that specifies the desired type value.
If your new Service SAF is to be invoked only when the requested resource is in a particular directory, you might need to define a NameTrans directive that generates a name or ppath value that matches another object, and then in the new object you could invoke the new Service function.
For example, suppose your plug-in defines two new SAFs, do_small_anim() and do_big_anim(), which both take speed parameters. These functions run animations. All files to be treated as small animations reside in the directory D:/Sun/WebServer61/server1/docs/animations/small, while all files to be treated as full-screen animations reside in the directory D:/Sun/WebServer61/server1/docs/animations/fullscreen.
To ensure that the new animation functions are invoked whenever a client sends a request for either a small or full-screen animation, you would add NameTrans directives to the default object to translate the appropriate URLs to the corresponding path names and also assign a name to the request.
NameTrans fn=pfx2dir from="/animations/small" dir="D:/Sun/WebServer61/server1/docs/animations/small" name="small_anim" NameTrans fn=pfx2dir from="/animations/fullscreen" dir="D:/Sun/WebServer61/server1docs/animations/fullscreen" name="fullscreen_anim"
<Object name="small_anim"> Service fn=do_small_anim speed=40 </Object> <Object name="fullscreen_anim"> Service fn=do_big_anim speed=20 </Object>