The server executes a NameTrans directive in the default object to map the logical URL of the requested resource to a physical path name on the server’s file system. For example, the URL http://www.test.com/some/file.html could be translated to the full file system path:
The server looks at each NameTrans directive in the default object in turn, until it finds one that can be applied.
Because the server might not execute all NameTrans directives, the order in which the directives appear is important. For example:
NameTrans fn="document-root" root="D:/sun/webserver7/https-server/docs" NameTrans fn="pfx2dir" from="/cgi" dir="D:/sun/webserver7/https-server/docs/mycgi" name="cgi"
In this example, the directive that calls pfx2dir will never be executed because the previous directive always establishes the physical path name for the resource. For the /cgi prefix to work, the directive that calls pfx2dir must be moved before the directive that calls document-root.
If no directive sets the physical path name, the server translates the logical URL to a file system path relative to the document root. The document root is specified by the document-root element in server.xml. For more information on the document-root element, see virtual-server.
As a result of executing a NameTrans directive, the server might start processing directives in another object. This happens if the NameTrans directive that was successfully executed specifies a name or generates a partial path that matches the name or ppath attribute of another object.
If the successful NameTrans directive assigns a name by specifying a name argument, the server starts processing directives in the named object (defined with the object tag) before processing directives in the default object for the rest of the request-handling process.
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/webserver7/https-server/docs/mycgi" name="cgi" ... </Object>
When the NameTrans directive is executed, the server starts processing directives in the object named cgi:
<Object name="cgi"> </Object>
When a NameTrans directive is successfully executed, there is a physical path name associated with the requested resource. If the resultant path name matches the ppath (partial path) attribute of another object, the server starts processing directives in the other object before processing directives in the default object for the rest of the request-handling process.
For example, assume obj.conf contains an object as follows:
<Object ppath ="*internal*"> </Object>
Consider that a successful NameTrans directive translates the requested URL to the path name D:/sun/webserver7/https-server/docs/internalplan1.html. In this case, the partial path *internal* matches the path D:/sun/webserver7/https-server/docs/internalplan1.html. Hence, the server will process the directives in this object before processing the remaining directives in the default object.