° An app is now mounted as / on the embedded webserver if the
app name is "base", not when it scripts Helma self. This means that it is now possible to have more than one applications scripting the Helma server itself (e.g. a simple overview app in / and a sophisticated admin app in /admin). ° 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.
This commit is contained in:
parent
f7ec5f3bbd
commit
5b7495dca3
1 changed files with 9 additions and 12 deletions
|
@ -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");
|
||||
|
|
Loading…
Add table
Reference in a new issue