ASF Bugzilla – Attachment 29068 Details for
Bug 53553
[PATCH] Deploy uploaded WAR with context.xml from server
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Feature: Deploy uploaded WAR with local context descriptor
manager.diff (text/plain), 3.78 KB, created by
Anton Lindström
on 2012-07-16 21:31:09 UTC
(
hide
)
Description:
Feature: Deploy uploaded WAR with local context descriptor
Filename:
MIME Type:
Creator:
Anton Lindström
Created:
2012-07-16 21:31:09 UTC
Size:
3.78 KB
patch
obsolete
>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
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 53553
: 29068