FileFinderServlet finds the disk file associated with a request. More specifically, this servlet sets the pathTranslated property of a request by appending the pathInfo property to a document root. The document root is specified as the documentRoot property of the servlet. This document root is relative to the directory where you run the Oracle ATG Web Commerce server, or it can be an absolute pathname. For example:


If a pathInfo specifies a directory rather than a file, this servlet searches for an index file in that directory. If an index file is found, the pathInfo and requestURI properties are rewritten to use that index file, and the pathTranslated property is set to point to that index file. The list of possible index files is specified in the indexFiles property.

If no such index file is found, this servlet can then handle the request by listing the files in that directory. This only happens if the shouldListDirectory property is true; otherwise a file not found error is returned.

If the specified file or index file is found and the pathTranslated property is set, the request is passed to the next servlet. Otherwise a file not found error is returned.

One special case comes up when a directory request comes in without a trailing slash character. In this case, the browser must change its request to have a trailing slash in order to handle relative requests properly. The FileFinder servlet accomplishes this by issuing a redirect to the browser using the same request URI but including a trailing slash.

alwaysTranslate Property

By default, when you run an Oracle ATG Web Commerce server with a commercial web server, such as Apache or Microsoft IIS, the web server translates the PathInfo information setting PathTranslated. This allows the Oracle ATG Web Commerce server to use virtual directories and other special path translation that is normally able to be performed by the web server. In this situation, the FileFinderServlet just passes the request on to the next servlet in the pipeline when it sees this request. This requires the web server and the Oracle ATG Web Commerce server to have the same file system path structure for documents, even if they are on separate machines.

In this case, the FileFinderServlet still translates pathInfos that are requested from an Oracle ATG Web Commerce server. This includes any calls to the method DynamoHttpServletRequest.getRealPath("/pathinfo").

Using the web server’s path translation requires that the Oracle ATG Web Commerce server and web server can see documents served with the same absolute pathname. For example, if the web server serves files from /sun/webserver6.1/docs, the Oracle ATG Web Commerce server must also see files in /sun/webserver6.1/docs.

You can change this behavior by setting the alwaysTranslate property to true in the FileFinderServlet. In this case, the web server is still responsible for determining whether requests are sent to the Oracle ATG Web Commerce server or not, but the application always performs path translation, overriding the translation performed by the web server. This allows the document roots to be located at different absolute paths. Setting alwaysTranslate="true" can also improve security by preventing the Oracle ATG Web Commerce server from serving any file outside of the document root. This can have a security benefit, as it can block attempts to have Oracle ATG Web Commerce server serve files that are not meant to be served to users.

Translation of Index or Default Files

When the web server sees a request for a directory, it typically translates this pathInfo into a request for one of a list of files such as index.html, index.jsp and so on. When the web server performs path translation, it must be able to see the index file in its document root. By default, the FileFinderServlet only performs index files translation if it is performing pathTranslation as well. You can set the processIndexFiles property to true to have it try to expand index files even if PathTranslated is already set. This typically is only necessary for web servers that turn /foo/ into /docs/foo/ in cases where the path translation should be /foo/ to /docs/foo/index.html.

Virtual File Translation

When the FileFinderServlet is performing path translation, it can also translate a list of virtual directories. A virtual directory lets you map all pathInfos that start with a particular path prefix to a separate directory on your file system. The virtual directories are specified in FileFinderServlet by the virtualDirectoryMap property. This property contains a list of mappings of the form: /pathInfoPrefix=/fileSystemPath. For example:


You should set the virtual directories if you set always Translate="true" or if you translate paths via the request.getRealPath() method.