
Legacy Configuration Files
Chapter 8 Legacy Servlet and JSP Configuration 89
Here is an example of rules.properties.
# Servlet rules properties
#
# This file specifies the translation rules for invoking servlets.
# The syntax is:
# <virtual-path>=<servlet-name>
#or
# @regular_expression=<servlet-name> (use double back-slashes)
#
# where <virtual-path> is the virtual path used to invoke the servlet,
# and <servlet-name> is the name of the servlet. Surrounding white space
# is ignored. The ordering of the rules is not important, as the longest
# match will always be used first. Use of regular expression can lead to
# a heavy peformance penalty
#
################################# rules ################################
/mytest1=tracker
/mytest2=demo1
Using Regular Expressions in rules.properties
iPlanet Web Server supports regular expressions in the rules.properties file to
run a given servlet when the incoming URL matches with a regular expression.
However, the example given in the file header is incorrect:
The
\\ characters are supposed to escape the (.) extension. The intent is to run the
example
wasp servlet whenever there is a request for URLs such as /my/xxx.foo.
However, iPlanet Web Server replaces
/ or \ characters with /, subsequently
changing the whole semantics. To get around this, specify the regular expression
without the
/ or \ characters:
@.*[.]foo$=wasp
For another way to direct files of a specific type to a specific servlet, see the
description of the
servlet-mapping element in the web.xml file, which is
described in the Servlet 2.2 API specification:
http://java.sun.com/products/servlet/index.html
# Example:
#
# /simple=SimpleServlet\n
# @.*\\.foo=wasp
Commentaires sur ces manuels