tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remy Maucherat <>
Subject Re: ManagerServlet undeploy
Date Fri, 19 Sep 2003 05:51:49 GMT
Amy Roh wrote:
> Undeploy fails for any app that's not installed under webapps directory. 
>  For example, an attempt to undeploy /admin will fail with "Cannot 
> undeploy document base for path /admin" because of the following lines 
> from ManagerServlet line 1384
>             // Validate the docBase path of this application
>             String deployedPath = deployed.getCanonicalPath();
>             String docBase = context.getDocBase();
>             File docBaseDir = new File(docBase);
>             if (!docBaseDir.isAbsolute()) {
>                 docBaseDir = new File(appBaseDir, docBase);
>             }
>             String docBasePath = docBaseDir.getCanonicalPath();
>             if (!docBasePath.startsWith(deployedPath)) {
>                 writer.println(sm.getString("managerServlet.noDocBase",
>                                             displayPath));
>                 return;
>             }
> Any app that's installed using context configuration file with docBase 
> other than "../webapps" will not pass the condition since deployedPath 
> is always ../webapps.
> What is the reasoning behind this validation?

A webapp which isn't in the host appbase shouldn't be deleted because it 
wasn't installed by the manager. Not allowing to undeploy is a bit too 
much, and I'll fix the condition (maybe I did cut & paste from somewhere 
else ...) :-)

Basically the updated logic will be:
- if the WAR is somewhere, and the expanded dir is in appBase, remove 
the expanded dir
- if there's a context file, remove it
That's consistent with the behavior for a webapp deployed in appBase, 
while avoiding removing stuff which isn't under Tomcat control.


View raw message