remm 2003/07/25 09:01:37 Modified: webapps/manager/WEB-INF/classes/org/apache/catalina/manager HTMLManagerServlet.java Log: - Allow the posted WAR to include a META-INF/context.xml, similar to the upload Ant task, for consistency. Revision Changes Path 1.5 +26 -7 jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager/HTMLManagerServlet.java Index: HTMLManagerServlet.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager/HTMLManagerServlet.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- HTMLManagerServlet.java 22 Jun 2003 16:41:36 -0000 1.4 +++ HTMLManagerServlet.java 25 Jul 2003 16:01:37 -0000 1.5 @@ -205,6 +205,8 @@ upload.setRepositoryPath(tempdir.getCanonicalPath()); // Parse the request + String basename = null; + File appBaseDir = null; String war = null; FileItem warUpload = null; try { @@ -224,7 +226,7 @@ } } } - while(true) { + while (true) { if (warUpload == null) { message = sm.getString ("htmlManagerServlet.deployUploadNoFile"); @@ -246,13 +248,13 @@ // Identify the appBase of the owning Host of this Context // (if any) String appBase = null; - File appBaseDir = null; appBase = ((Host) context.getParent()).getAppBase(); appBaseDir = new File(appBase); if (!appBaseDir.isAbsolute()) { appBaseDir = new File(System.getProperty("catalina.base"), appBase); } + basename = war.substring(0, war.indexOf(".war")); File file = new File(appBaseDir, war); if (file.exists()) { message = sm.getString @@ -281,9 +283,26 @@ warUpload = null; } + // Extract the nested context deployment file (if any) + File localWar = new File(appBaseDir, basename + ".war"); + File localXml = new File(configBase, basename + ".xml"); + try { + extractXml(localWar, localXml); + } catch (IOException e) { + log("managerServlet.extract[" + localWar + "]", e); + return; + } + String config = null; + try { + URL url = localXml.toURL(); + config = url.toString(); + } catch (MalformedURLException e) { + throw e; + } + // If there were no errors, deploy the WAR if (message.length() == 0) { - message = deployInternal(null, null, war); + message = deployInternal(config, null, war); } list(request, response, message);
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]