[ Team LiB ] |
7.4 Creating the cactus.properties File7.4.1 ProblemYou are setting up your Cactus environment and need to create the cactus.properties file. 7.4.2 SolutionCreate a file called cactus.properties and place it on the client classpath. 7.4.3 DiscussionCactus uses a Java properties file called cactus.properties to specify client-side attributes needed to successfully execute your tests. This file must be located on the client classpath, and simply tells Cactus the web context of your test application and the redirector values. The redirector values are URL patterns used in the deployment descriptor that point to a particular Cactus redirector proxy. Here's an example of the cactus.properties file: cactus.contextURL=http://localhost:8080/xptest cactus.servletRedirectorName=ServletRedirector cactus.jspRedirectorName=JspRedirector cactus.filterRedirectorName=FilterRedirector Here's the corresponding deployment descriptor web.xml file:[6]
<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <filter> <filter-name>FilterRedirector</filter-name> <filter-class> org.apache.cactus.server.FilterTestRedirector </filter-class> </filter> <filter-mapping> <filter-name>FilterRedirector</filter-name> <url-pattern>/FilterRedirector</url-pattern> </filter-mapping> <servlet> <servlet-name>ServletRedirector</servlet-name> <servlet-class> org.apache.cactus.server.ServletTestRedirector </servlet-class> </servlet> <servlet> <servlet-name>JspRedirector</servlet-name> <jsp-file>/jspRedirector.jsp</jsp-file> </servlet> <servlet> <servlet-name>CustomerServlet</servlet-name> <servlet-class> com.oreilly.javaxp.cactus.servlet.CustomerServlet </servlet-class> </servlet> <servlet-mapping> <servlet-name>JspRedirector</servlet-name> <url-pattern>/JspRedirector</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>ServletRedirector</servlet-name> <url-pattern>/ServletRedirector</url-pattern> </servlet-mapping> </web-app> Table 7-1 describes each property in detail.
7.4.4 See AlsoRecipe 7.5 shows how to use Ant to automatically generate the cactus.properties file. |
[ Team LiB ] |