It is now possible to bind to RMI and embedded Web/AJP1.3 server at the same time.
(this used to be mutually exclusive until now).
This commit is contained in:
parent
ef18e63042
commit
5c7dbb717c
2 changed files with 32 additions and 19 deletions
|
@ -134,9 +134,12 @@ public class ApplicationManager {
|
||||||
Server.getLogger().log ("Stopping application "+appName);
|
Server.getLogger().log ("Stopping application "+appName);
|
||||||
try {
|
try {
|
||||||
Application app = (Application) applications.get (appName);
|
Application app = (Application) applications.get (appName);
|
||||||
if (server.http == null) {
|
// unbind from RMI server
|
||||||
|
if (port > 0) {
|
||||||
Naming.unbind ("//:"+port+"/"+appName);
|
Naming.unbind ("//:"+port+"/"+appName);
|
||||||
} else {
|
}
|
||||||
|
// unbind from Jetty HTTP server
|
||||||
|
if (server.http != null) {
|
||||||
String mountpoint = mountpoints.getProperty (appName);
|
String mountpoint = mountpoints.getProperty (appName);
|
||||||
HttpContext context = server.http.getContext (null, mountpoint);
|
HttpContext context = server.http.getContext (null, mountpoint);
|
||||||
if (context != null) {
|
if (context != null) {
|
||||||
|
@ -156,9 +159,12 @@ public class ApplicationManager {
|
||||||
try {
|
try {
|
||||||
Server.getLogger().log ("Binding application "+appName);
|
Server.getLogger().log ("Binding application "+appName);
|
||||||
Application app = (Application) applications.get (appName);
|
Application app = (Application) applications.get (appName);
|
||||||
if (server.http == null) {
|
// bind to RMI server
|
||||||
Naming.rebind ("//:"+port+"/"+appName, app);
|
if (port > 0) {
|
||||||
} else {
|
Naming.rebind ("//:"+port+"/"+appName, new RemoteApplication (app));
|
||||||
|
}
|
||||||
|
// bind to Jetty HTTP server
|
||||||
|
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 (server.ajp13Port == 0)
|
||||||
|
|
|
@ -44,8 +44,8 @@ import org.mortbay.http.ajp.*;
|
||||||
static SystemProperties sysProps;
|
static SystemProperties sysProps;
|
||||||
|
|
||||||
// server ports
|
// server ports
|
||||||
int rmiPort = 5055;
|
int rmiPort = 0;
|
||||||
int xmlrpcPort = 5056;
|
int xmlrpcPort = 0;
|
||||||
int websrvPort = 0;
|
int websrvPort = 0;
|
||||||
int ajp13Port = 0;
|
int ajp13Port = 0;
|
||||||
|
|
||||||
|
@ -222,13 +222,24 @@ import org.mortbay.http.ajp.*;
|
||||||
|
|
||||||
dbSources = new Hashtable ();
|
dbSources = new Hashtable ();
|
||||||
|
|
||||||
|
// check server ports. If no port is set,
|
||||||
|
// use 5055 for RMI and 5056 for XML-RPC.
|
||||||
|
if ((websrvPort | ajp13Port | rmiPort) == 0) {
|
||||||
|
rmiPort = 5055;
|
||||||
|
if (xmlrpcPort == 0)
|
||||||
|
xmlrpcPort = 5056;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if servers are already running on the given ports
|
||||||
try {
|
try {
|
||||||
// check if servers are already running on the given ports
|
if (websrvPort > 0)
|
||||||
if (websrvPort==0)
|
|
||||||
checkRunning (rmiPort);
|
|
||||||
else
|
|
||||||
checkRunning (websrvPort);
|
checkRunning (websrvPort);
|
||||||
checkRunning (xmlrpcPort);
|
if (rmiPort > 0)
|
||||||
|
checkRunning (rmiPort);
|
||||||
|
if (xmlrpcPort > 0)
|
||||||
|
checkRunning (xmlrpcPort);
|
||||||
|
if (ajp13Port > 0)
|
||||||
|
checkRunning (ajp13Port);
|
||||||
} catch (Exception running) {
|
} catch (Exception running) {
|
||||||
System.out.println (running.getMessage ());
|
System.out.println (running.getMessage ());
|
||||||
System.exit (1);
|
System.exit (1);
|
||||||
|
@ -315,7 +326,7 @@ import org.mortbay.http.ajp.*;
|
||||||
String xmlparser = sysProps.getProperty ("xmlparser");
|
String xmlparser = sysProps.getProperty ("xmlparser");
|
||||||
if (xmlparser != null)
|
if (xmlparser != null)
|
||||||
XmlRpc.setDriver (xmlparser);
|
XmlRpc.setDriver (xmlparser);
|
||||||
// XmlRpc.setDebug (true);
|
|
||||||
xmlrpc = new WebServer (xmlrpcPort);
|
xmlrpc = new WebServer (xmlrpcPort);
|
||||||
if (paranoid) {
|
if (paranoid) {
|
||||||
xmlrpc.setParanoid (true);
|
xmlrpc.setParanoid (true);
|
||||||
|
@ -341,7 +352,7 @@ import org.mortbay.http.ajp.*;
|
||||||
RMISocketFactory.setSocketFactory (factory);
|
RMISocketFactory.setSocketFactory (factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (http == null) {
|
if (rmiPort > 0) {
|
||||||
getLogger().log ("Starting RMI server on port "+rmiPort);
|
getLogger().log ("Starting RMI server on port "+rmiPort);
|
||||||
LocateRegistry.createRegistry (rmiPort);
|
LocateRegistry.createRegistry (rmiPort);
|
||||||
}
|
}
|
||||||
|
@ -361,10 +372,6 @@ import org.mortbay.http.ajp.*;
|
||||||
appManager.startAll ();
|
appManager.startAll ();
|
||||||
|
|
||||||
// start embedded web server
|
// start embedded web server
|
||||||
/* if (websrv != null) {
|
|
||||||
Thread webthread = new Thread (websrv, "WebServer");
|
|
||||||
webthread.start ();
|
|
||||||
} */
|
|
||||||
if (http != null) try {
|
if (http != null) try {
|
||||||
http.start ();
|
http.start ();
|
||||||
} catch (MultiException m) {
|
} catch (MultiException m) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue