1.1 --- a/tools/JavaServlet/build.py Tue Sep 21 18:00:01 2004 +0000
1.2 +++ b/tools/JavaServlet/build.py Tue Sep 21 18:00:29 2004 +0000
1.3 @@ -75,12 +75,12 @@
1.4 def get_appname(handler):
1.5 return os.path.split(os.path.splitext(handler)[0])[1]
1.6
1.7 -def make_app(handler, appdir, webstack_home):
1.8 +def make_app(handler, appdir, webstack_home, web_xml_template_name):
1.9
1.10 """
1.11 Make the application directory from the given 'handler', application
1.12 - directory 'appdir' and the 'webstack_home' where the WebStack package can be
1.13 - found.
1.14 + directory 'appdir', the 'webstack_home' where the WebStack package can be
1.15 + found, and the deployment descriptor with the given 'web_xml_template_name'.
1.16 """
1.17
1.18 appname = get_appname(handler)
1.19 @@ -118,7 +118,7 @@
1.20
1.21 # Configure the deployment descriptor.
1.22
1.23 - f = open(os.path.join(webstack_home, "tools", "JavaServlet", "web.xml"))
1.24 + f = open(os.path.join(webstack_home, "tools", "JavaServlet", web_xml_template_name))
1.25 web_xml = f.read()
1.26 f.close()
1.27 web_xml = web_xml % (jython_home, handler_filename)
1.28 @@ -131,7 +131,7 @@
1.29
1.30 if __name__ == "__main__":
1.31 import sys
1.32 - if len(sys.argv) < 4:
1.33 + if len(sys.argv) < 5:
1.34 print "Please specify..."
1.35 print " * The location of the application handler."
1.36 print " eg. .../WebStack-x.y/examples/JavaServlet/SimpleApp.py"
1.37 @@ -139,18 +139,20 @@
1.38 print " eg. .../WebStack-x.y/examples/Common/Simple"
1.39 print " * The location of the WebStack package distribution."
1.40 print " eg. .../WebStack-x.y"
1.41 + print " * The name of the deployment descriptor template."
1.42 + print " eg. web.xml"
1.43 print "You can also specify some additional libraries for the application..."
1.44 print " eg. $CATALINA_HOME/common/lib/activation.jar"
1.45 print " $CATALINA_HOME/common/lib/mail.jar"
1.46 sys.exit(1)
1.47
1.48 print "Making application directory..."
1.49 - make_app(sys.argv[1], sys.argv[2], sys.argv[3])
1.50 + make_app(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
1.51
1.52 - if len(sys.argv) > 4:
1.53 + if len(sys.argv) > 5:
1.54 print "Copying additional libraries..."
1.55 appname = get_appname(sys.argv[1])
1.56 - for library in sys.argv[4:]:
1.57 + for library in sys.argv[5:]:
1.58 library_dir, library_name = os.path.split(library)
1.59 library_dest = os.path.join(appname, "WEB-INF", "lib", library_name)
1.60 copy_file(library, library_dest)
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/tools/JavaServlet/protected-web.xml Tue Sep 21 18:00:29 2004 +0000
2.3 @@ -0,0 +1,53 @@
2.4 +<!DOCTYPE web-app
2.5 + PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
2.6 + "http://java.sun.com/dtd/web-app_2_3.dtd">
2.7 +
2.8 +<web-app>
2.9 +
2.10 + <display-name>WebStack application</display-name>
2.11 + <description>
2.12 + An application based on WebStack
2.13 + </description>
2.14 +
2.15 + <servlet>
2.16 + <servlet-name>pyservlet</servlet-name>
2.17 + <servlet-class>uk.org.boddie.webstack.util.PyServlet</servlet-class>
2.18 + <init-param>
2.19 + <param-name>python.home</param-name>
2.20 + <param-value>%s</param-value>
2.21 + </init-param>
2.22 + <init-param>
2.23 + <param-name>servlet.file</param-name>
2.24 + <param-value>%s</param-value>
2.25 + </init-param>
2.26 + </servlet>
2.27 +
2.28 + <servlet-mapping>
2.29 + <servlet-name>pyservlet</servlet-name>
2.30 + <url-pattern>/*</url-pattern>
2.31 + </servlet-mapping>
2.32 +
2.33 + <security-constraint>
2.34 + <display-name>WebStack Security Constraint</display-name>
2.35 + <web-resource-collection>
2.36 + <web-resource-name>Protected Resources</web-resource-name>
2.37 + <url-pattern>/*</url-pattern>
2.38 + </web-resource-collection>
2.39 + <auth-constraint>
2.40 + <role-name>webstack</role-name>
2.41 + </auth-constraint>
2.42 + </security-constraint>
2.43 +
2.44 + <login-config>
2.45 + <auth-method>BASIC</auth-method>
2.46 + <realm-name>WebStack Realm</realm-name>
2.47 + </login-config>
2.48 +
2.49 + <security-role>
2.50 + <description>
2.51 + The role that is required to log in to this application
2.52 + </description>
2.53 + <role-name>webstack</role-name>
2.54 + </security-role>
2.55 +
2.56 +</web-app>