From 5b7495dca3dc39f3a232d86504447caf5a87f22a Mon Sep 17 00:00:00 2001 From: hns Date: Thu, 7 Mar 2002 17:14:46 +0000 Subject: [PATCH] =?UTF-8?q?=C2=B0=20An=20app=20is=20now=20mounted=20as=20/?= =?UTF-8?q?=20on=20the=20embedded=20webserver=20if=20the=20app=20name=20is?= =?UTF-8?q?=20"base",=20not=20when=20it=20scripts=20Helma=20self.=20This?= =?UTF-8?q?=20means=20that=20it=20is=20now=20possible=20to=20have=20more?= =?UTF-8?q?=20than=20one=20applications=20scripting=20the=20Helma=20server?= =?UTF-8?q?=20itself=20(e.g.=20a=20simple=20overview=20app=20in=20/=20and?= =?UTF-8?q?=20a=20sophisticated=20admin=20app=20in=20/admin).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ° Removed self boolean parameter from start() and register(), since this is now determined just once and doesn't have to be carried around. Also, callers of these methods from outside didn't really know about this parameter. --- src/helma/main/ApplicationManager.java | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/src/helma/main/ApplicationManager.java b/src/helma/main/ApplicationManager.java index 4f53c300..ac4ede4f 100644 --- a/src/helma/main/ApplicationManager.java +++ b/src/helma/main/ApplicationManager.java @@ -47,10 +47,9 @@ public class ApplicationManager { try { for (Enumeration e = props.keys(); e.hasMoreElements (); ) { String appName = (String) e.nextElement (); - boolean self = "self".equalsIgnoreCase (props.getProperty (appName)); if (applications.get (appName) == null) { - start (appName, self); - register (appName, self); + start (appName); + register (appName); } } // then stop deleted ones @@ -68,15 +67,16 @@ public class ApplicationManager { } } - void start (String appName, boolean self) { + void start (String appName) { Server.getLogger().log ("Building application "+appName); try { Application app = new Application (appName, hopHome, Server.sysProps, Server.dbProps); applications.put (appName, app); // if we're running with the embedded web server, set app base uri to /appname - if (server.websrv != null && !self) + if (server.websrv != null && !"base".equalsIgnoreCase (appName)) app.setBaseURI ("/"+java.net.URLEncoder.encode (appName)); // check if the root object of the application is the Server itself + boolean self = "self".equalsIgnoreCase (props.getProperty (appName)); if (self) app.setDataRoot (server); // the application is started later in the register method, when it's bound @@ -105,16 +105,15 @@ public class ApplicationManager { applications.remove (appName); } - void register (String appName, boolean self) { + void register (String appName) { try { Server.getLogger().log ("Binding application "+appName); Application app = (Application) applications.get (appName); - // app.start (); if (server.websrv == null) { Naming.rebind ("//:"+port+"/"+appName, app); } else { AcmeServletClient servlet = new AcmeServletClient (app); - if (self) + if ("base".equalsIgnoreCase (appName)) server.websrv.setDefaultServlet (servlet); else { server.websrv.addServlet ("/"+appName+"/", servlet); @@ -131,13 +130,11 @@ public class ApplicationManager { try { for (Enumeration e = props.keys(); e.hasMoreElements (); ) { String appName = (String) e.nextElement (); - boolean self = "self".equalsIgnoreCase (props.getProperty (appName)); - start (appName, self); + start (appName); } for (Enumeration e = props.keys(); e.hasMoreElements (); ) { String appName = (String) e.nextElement (); - boolean self = "self".equalsIgnoreCase (props.getProperty (appName)); - register (appName, self); + register (appName); } if (server.websrv != null) { File staticContent = new File (server.getHopHome(), "static");