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; 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. * 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 // set base URI
String base = props.getProperty ("baseURI"); String base = props.getProperty ("baseURI");
if (base != null) if (base != null)
setBaseURI (base); setBaseURI (base);
else if (baseURI == null) else if (baseURI == null)
baseURI = "/"; baseURI = "/";
// if node manager exists, update it // if node manager exists, update it
if (nmgr != null) if (nmgr != null)
nmgr.updateProperties (props); nmgr.updateProperties (props);

View file

@ -80,10 +80,8 @@ public class ApplicationManager {
oldContext.destroy (); oldContext.destroy ();
} }
Application app = (Application) applications.get (appName); Application app = (Application) applications.get (appName);
// if using embedded webserver (not AJP) set application URL prefix if (!app.hasExplicitBaseURI())
if (server.ajp13Port == 0)
app.setBaseURI (mountpoint); app.setBaseURI (mountpoint);
app.setBaseURI (mountpoint);
ServletHttpContext context = new ServletHttpContext (); ServletHttpContext context = new ServletHttpContext ();
context.setContextPath(pattern); context.setContextPath(pattern);
server.http.addContext (context); server.http.addContext (context);
@ -167,7 +165,7 @@ public class ApplicationManager {
if (server.http != null) { if (server.http != null) {
String mountpoint = getMountpoint (appName); String mountpoint = getMountpoint (appName);
// if using embedded webserver (not AJP) set application URL prefix // if using embedded webserver (not AJP) set application URL prefix
if (server.ajp13Port == 0) if (!app.hasExplicitBaseURI ())
app.setBaseURI (mountpoint); app.setBaseURI (mountpoint);
String pattern = getPathPattern (mountpoint); String pattern = getPathPattern (mountpoint);
ServletHttpContext context = new ServletHttpContext (); ServletHttpContext context = new ServletHttpContext ();
@ -182,6 +180,9 @@ public class ApplicationManager {
String uploadLimit = props.getProperty (appName+".uploadLimit"); String uploadLimit = props.getProperty (appName+".uploadLimit");
if (uploadLimit != null) if (uploadLimit != null)
holder.setInitParameter ("uploadLimit", uploadLimit); holder.setInitParameter ("uploadLimit", uploadLimit);
String debug = props.getProperty (appName+".debug");
if (debug != null)
holder.setInitParameter ("debug", debug);
// holder.start (); // holder.start ();
context.start (); context.start ();
mountpoints.setProperty (appName, pattern); mountpoints.setProperty (appName, pattern);