Set baseURI in applications from ApplicationManager iff it isn't defined in the app properties.

This commit is contained in:
hns 2002-10-01 22:49:10 +00:00
parent e3834af297
commit 09f046f87a
2 changed files with 16 additions and 7 deletions

View file

@ -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);

View file

@ -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);