Sun Java System Web Server 6.1 SP7 NSAPI Programmer's Guide

The Object Tag

Directives in the obj.conf file are grouped into objects that begin with an <Object> tag and end with an </Object> tag. The default object provides instructions to the server about how to process requests by default. Each new object modifies the default object’s behavior.

An Object tag may have a name attribute or a ppath attribute. Either parameter may be a wildcard pattern. For example:

<Object name="cgi">

- or -

<Object ppath="/usr/sun/webserver61/server1/docs/private/*">

The server always starts handling a request by processing the directives in the default object. However, the server switches to processing directives in another object after the NameTrans stage of the default object if either of the following conditions is true:

Objects that Use the name Attribute

If a NameTrans directive in the default object specifies a name argument, the server switches to processing the directives in the object of that name before processing the remaining directives in the default object.

For example, the following NameTrans directive in the default object assigns the name cgi to any request whose URL starts with http://server_name/cgi/:

<Object name="default">
NameTrans fn="pfx2dir" from="/cgi" 
dir="D:/sun/webserver61/server1/docs/mycgi" 
name="cgi"...
</Object>

When that NameTrans directive is executed, the server starts processing directives in the object named cgi:


<Object name="cgi">
more directives...
</Object>

Objects that Use the ppath Attribute

When the server finishes processing the NameTrans directives in the default object, the logical URL of the request will have been converted to a physical path name. If this physical path name matches the ppath attribute of another object in obj.conf, the server switches to processing the directives in that object before processing the remaining ones in the default object.

For example, the following NameTrans directive translates the http://server_name/ part of the requested URL to D:/Sun/WebServer61/server1/docs/ (which is the document root directory):


<Object name="default">
NameTrans fn="document-root" 
root="D:/Sun/WebServer61/server1/docs"
...
</Object>

The URL http://server_name/internalplan1.html would be translated to D:/Sun/WebServer61/server1/docs/internalplan1.html. However, suppose that obj.conf contains the following additional object:

<Object ppath="*internal*">
more directives...
</Object>

In this case, the partial path *internal* matches the path D:/Sun/WebServer61/server1/docs/internalplan1.html. So now the server starts processing the directives in this object before processing the remaining directives in the default object.