# HG changeset patch # User paulb # Date 1095789629 0 # Node ID 366d3bf33e95dd1fe49409c31187a272d6c28c54 # Parent 27d97f3262375f0a0b0533b2f48e4e02b5bb1b3d [project @ 2004-09-21 18:00:29 by paulb] Added authentication/authorisation deployment descriptor support, tested with Apache Tomcat. diff -r 27d97f326237 -r 366d3bf33e95 tools/JavaServlet/build.py --- a/tools/JavaServlet/build.py Tue Sep 21 18:00:01 2004 +0000 +++ b/tools/JavaServlet/build.py Tue Sep 21 18:00:29 2004 +0000 @@ -75,12 +75,12 @@ def get_appname(handler): return os.path.split(os.path.splitext(handler)[0])[1] -def make_app(handler, appdir, webstack_home): +def make_app(handler, appdir, webstack_home, web_xml_template_name): """ Make the application directory from the given 'handler', application - directory 'appdir' and the 'webstack_home' where the WebStack package can be - found. + directory 'appdir', the 'webstack_home' where the WebStack package can be + found, and the deployment descriptor with the given 'web_xml_template_name'. """ appname = get_appname(handler) @@ -118,7 +118,7 @@ # Configure the deployment descriptor. - f = open(os.path.join(webstack_home, "tools", "JavaServlet", "web.xml")) + f = open(os.path.join(webstack_home, "tools", "JavaServlet", web_xml_template_name)) web_xml = f.read() f.close() web_xml = web_xml % (jython_home, handler_filename) @@ -131,7 +131,7 @@ if __name__ == "__main__": import sys - if len(sys.argv) < 4: + if len(sys.argv) < 5: print "Please specify..." print " * The location of the application handler." print " eg. .../WebStack-x.y/examples/JavaServlet/SimpleApp.py" @@ -139,18 +139,20 @@ print " eg. .../WebStack-x.y/examples/Common/Simple" print " * The location of the WebStack package distribution." print " eg. .../WebStack-x.y" + print " * The name of the deployment descriptor template." + print " eg. web.xml" print "You can also specify some additional libraries for the application..." print " eg. $CATALINA_HOME/common/lib/activation.jar" print " $CATALINA_HOME/common/lib/mail.jar" sys.exit(1) print "Making application directory..." - make_app(sys.argv[1], sys.argv[2], sys.argv[3]) + make_app(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4]) - if len(sys.argv) > 4: + if len(sys.argv) > 5: print "Copying additional libraries..." appname = get_appname(sys.argv[1]) - for library in sys.argv[4:]: + for library in sys.argv[5:]: library_dir, library_name = os.path.split(library) library_dest = os.path.join(appname, "WEB-INF", "lib", library_name) copy_file(library, library_dest) diff -r 27d97f326237 -r 366d3bf33e95 tools/JavaServlet/protected-web.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/JavaServlet/protected-web.xml Tue Sep 21 18:00:29 2004 +0000 @@ -0,0 +1,53 @@ + + + + + WebStack application + + An application based on WebStack + + + + pyservlet + uk.org.boddie.webstack.util.PyServlet + + python.home + %s + + + servlet.file + %s + + + + + pyservlet + /* + + + + WebStack Security Constraint + + Protected Resources + /* + + + webstack + + + + + BASIC + WebStack Realm + + + + + The role that is required to log in to this application + + webstack + + +