Sometimes it is better to have Netscape serve the static pages (html, gif, jpeg etc.)
even if these files are part of a context served by Tomcat. For example, consider the html and gif files in the examples context, there is no need to serve them from the Tomcat process, Netscape will suffice.
Making Netscape serve static files that are part of the Tomcat contexts requires the following:
-
Configuring Netscape to know about the Tomcat contexts
-
Make sure that the WEB-INF directory is protected from access.
-
Configuring Netscape to assign the NSAPI redirector only specific requests that requires JSP/Servlet handling.
Adding a Tomcat context to Netscape requires the addition of a new Netscape virtual directory
that covers the Tomcat context.
For example, adding a /example Netscape virtual directory that
covers the c:\tomcat\webapps\examples directory.
To add a new virtual directory add the following line to your obj.conf:
NameTrans fn=pfx2dir from=/examples dir="c:/tomcat/webapps/examples"
WEB-INF protection requires some explanation; Each servlet application (context) has a special directory named WEB-INF,
this directory contains sensitive configurations data and Java classes and must be kept hidden from web users.
WEB-INF can be protected by adding the following line to the PathCheck section in the default configuration object:
PathCheck fn="deny-existence" path="*/WEB-INF/*"
This line instructs the Netscape server to reject any request with a URL that contain the path /WEB-INF/.
Configuring Netscape to assign the NSAPI redirector only specific requests is somewhat harder,
you will need to specify the exact URL-Path pattern(s) that you want Tomcat to handle
(usually only JSP files and servlets).
This requires a change to NemaTrans portion of obj.conf.
For the examples context it requires to replace the following line:
NameTrans fn="assign-name" from="/examples/*" name="jknsapi"
with the following two lines:
NameTrans fn="assign-name" from="/examples/jsp/*.jsp" name="jknsapi"
NameTrans fn="assign-name" from="/examples/servlet/*" name="jknsapi"
As you can see the second configuration is more explicit, it actually instructs
Netscape to assign the redirector with only requests to resources under
/examples/servlet/ and resources under /examples/ whose name ends with .jsp.
You can be even more explicit and provide lines such as:
NameTrans fn="assign-name" from="/examples/servletname" name="jknsapi"
Instructs Netscape to assign the redirector request whose URL-Path equals /example/servletname