Index: java/org/apache/catalina/manager/ManagerServlet.java =================================================================== --- java/org/apache/catalina/manager/ManagerServlet.java (revision 1362227) +++ java/org/apache/catalina/manager/ManagerServlet.java (working copy) @@ -397,13 +397,14 @@ if (path != null) { cn = new ContextName(path, request.getParameter("version")); } + String config = request.getParameter("config"); String tag = request.getParameter("tag"); boolean update = false; if ((request.getParameter("update") != null) && (request.getParameter("update").equals("true"))) { update = true; } // Prepare our output writer to generate the response message response.setContentType("text/plain;charset="+Constants.CHARSET); PrintWriter writer = response.getWriter(); @@ -412,7 +413,7 @@ if (command == null) { writer.println(smClient.getString("managerServlet.noCommand")); } else if (command.equals("/deploy")) { - deploy(writer, cn, tag, update, request, smClient); + deploy(writer, config, cn, tag, update, request, smClient); } else { writer.println(smClient.getString("managerServlet.unknownCommand", command)); @@ -581,17 +582,27 @@ * at the specified context path. * * @param writer Writer to render results to + * @param config URL of the context configuration file to be installed * @param cn Name of the application to be installed * @param tag Tag to be associated with the webapp * @param request Servlet request we are processing */ protected synchronized void deploy - (PrintWriter writer, ContextName cn, + (PrintWriter writer, String config, ContextName cn, String tag, boolean update, HttpServletRequest request, StringManager smClient) { + if (config != null && config.length() == 0) { + config = null; + } + if (debug >= 1) { - log("deploy: Deploying web application '" + cn + "'"); + if (config != null) { + log("deploy: Deploying web application '" + cn + "' " + + "with context configuration at '" + config + "'"); + } else { + log("deploy: Deploying web application '" + cn + "'"); + } } // Validate the requested context path @@ -615,6 +626,10 @@ displayPath)); return; } + + if (config != null && (config.startsWith("file:"))) { + config = config.substring("file:".length()); + } // Calculate the base path File deployedPath = deployed; @@ -637,7 +652,20 @@ try { if (!isServiced(name)) { addServiced(name); - try { + try { + if (config != null) { + if (!configBase.mkdirs() && !configBase.isDirectory()) { + writer.println(smClient.getString( + "managerServlet.mkdirFail",configBase)); + return; + } + if (copy(new File(config), + new File(configBase, baseName + ".xml")) == false) { + throw new Exception("Could not copy config file from path '" + + config + "'"); + } + } + // Upload WAR uploadWar(writer, request, localWar, smClient); // Copy WAR and XML to the host app base if needed