From 09f046f87a74a91f3a92bd550998fc9062fe66cd Mon Sep 17 00:00:00 2001 From: hns Date: Tue, 1 Oct 2002 22:49:10 +0000 Subject: [PATCH] Set baseURI in applications from ApplicationManager iff it isn't defined in the app properties. --- src/helma/framework/core/Application.java | 14 +++++++++++--- src/helma/main/ApplicationManager.java | 9 +++++---- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/helma/framework/core/Application.java b/src/helma/framework/core/Application.java index d99c02d1..8650c549 100644 --- a/src/helma/framework/core/Application.java +++ b/src/helma/framework/core/Application.java @@ -868,6 +868,14 @@ public final class Application implements IPathElement, Runnable { this.baseURI = uri; } + /** + * Return true if the baseURI property is defined in the application + * properties, false otherwise. + */ + public boolean hasExplicitBaseURI () { + return props.containsKey ("baseuri"); + } + /** * Tell other classes whether they should output logging information for this application. */ @@ -1205,9 +1213,9 @@ public final class Application implements IPathElement, Runnable { // set base URI String base = props.getProperty ("baseURI"); if (base != null) - setBaseURI (base); - else if (baseURI == null) - baseURI = "/"; + setBaseURI (base); + else if (baseURI == null) + baseURI = "/"; // if node manager exists, update it if (nmgr != null) nmgr.updateProperties (props); diff --git a/src/helma/main/ApplicationManager.java b/src/helma/main/ApplicationManager.java index 09b378b6..f591b5e7 100644 --- a/src/helma/main/ApplicationManager.java +++ b/src/helma/main/ApplicationManager.java @@ -80,10 +80,8 @@ public class ApplicationManager { oldContext.destroy (); } Application app = (Application) applications.get (appName); - // if using embedded webserver (not AJP) set application URL prefix - if (server.ajp13Port == 0) + if (!app.hasExplicitBaseURI()) app.setBaseURI (mountpoint); - app.setBaseURI (mountpoint); ServletHttpContext context = new ServletHttpContext (); context.setContextPath(pattern); server.http.addContext (context); @@ -167,7 +165,7 @@ public class ApplicationManager { if (server.http != null) { String mountpoint = getMountpoint (appName); // if using embedded webserver (not AJP) set application URL prefix - if (server.ajp13Port == 0) + if (!app.hasExplicitBaseURI ()) app.setBaseURI (mountpoint); String pattern = getPathPattern (mountpoint); ServletHttpContext context = new ServletHttpContext (); @@ -182,6 +180,9 @@ public class ApplicationManager { String uploadLimit = props.getProperty (appName+".uploadLimit"); if (uploadLimit != null) holder.setInitParameter ("uploadLimit", uploadLimit); + String debug = props.getProperty (appName+".debug"); + if (debug != null) + holder.setInitParameter ("debug", debug); // holder.start (); context.start (); mountpoints.setProperty (appName, pattern);