cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets ManagerServlet.java

2004-04-27 Thread markt
markt   2004/04/27 15:55:10

  Modified:catalina/src/share/org/apache/catalina/servlets
ManagerServlet.java
  Log:
  - Fix bug 20786. Manger webapp session output not formatted correctly
for session inactive for <10 minutes.
  - Remove unused imports identified by Ecipse.
  
  Revision  ChangesPath
  1.33  +5 -7  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java
  
  Index: ManagerServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- ManagerServlet.java   14 Jan 2003 23:28:29 -  1.32
  +++ ManagerServlet.java   27 Apr 2004 22:55:10 -  1.33
  @@ -73,7 +73,6 @@
   import java.io.PrintWriter;
   import java.net.URL;
   import java.net.MalformedURLException;
  -import java.util.Enumeration;
   import java.util.Iterator;
   import java.util.Locale;
   import java.util.jar.JarEntry;
  @@ -89,7 +88,6 @@
   import javax.servlet.http.HttpServlet;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
  -import org.apache.catalina.Container;
   import org.apache.catalina.ContainerServlet;
   import org.apache.catalina.Context;
   import org.apache.catalina.Deployer;
  @@ -1055,7 +1053,7 @@
   }
   if (timeout[0] > 0)
   writer.println(sm.getString("managerServlet.sessiontimeout",
  -"<10" + timeout[0]));
  +"<10",  "" + timeout[0]));
   for (int i = 1; i < timeout.length-1; i++) {
   if (timeout[i] > 0)
   writer.println(sm.getString("managerServlet.sessiontimeout",
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets ManagerServlet.java

2003-01-14 Thread glenn
glenn   2003/01/14 15:28:29

  Modified:catalina/src/share/org/apache/catalina/servlets
ManagerServlet.java
  Log:
  Fix problems with empty String war parameters/args when using a context xml config
  
  Revision  ChangesPath
  1.32  +8 -4  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java
  
  Index: ManagerServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- ManagerServlet.java   14 Jan 2003 17:43:47 -  1.31
  +++ ManagerServlet.java   14 Jan 2003 23:28:29 -  1.32
  @@ -591,6 +591,10 @@
   protected void install(PrintWriter writer, String config,
  String path, String war) {
   
  +if (war != null && war.length() == 0) {
  +war = null;
  +}
  +
   if (debug >= 1) {
   if (config != null && config.length() > 0) {
   if (war != null) {
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets ManagerServlet.java

2003-01-14 Thread glenn
glenn   2003/01/14 09:43:48

  Modified:catalina/src/share/org/apache/catalina/servlets
ManagerServlet.java
  Log:
  Fix creation of context path for local war
  
  Revision  ChangesPath
  1.31  +5 -5  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java
  
  Index: ManagerServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- ManagerServlet.java   10 Jan 2003 15:52:18 -  1.30
  +++ ManagerServlet.java   14 Jan 2003 17:43:47 -  1.31
  @@ -669,7 +669,7 @@
   end -= 2;
   }
   if (filename.endsWith(".war")) {
  -filename = filename.substring(0,filename.length()-2);
  +filename = filename.substring(0,filename.length()-4);
   end -= 4;
   }
   if (filename.endsWith("/")) {
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets ManagerServlet.java

2003-01-04 Thread glenn
glenn   2003/01/04 05:43:49

  Modified:catalina/src/share/org/apache/catalina/servlets
ManagerServlet.java
  Log:
  Remove dead code
  
  Revision  ChangesPath
  1.29  +4 -6  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java
  
  Index: ManagerServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- ManagerServlet.java   18 Sep 2002 14:00:44 -  1.28
  +++ ManagerServlet.java   4 Jan 2003 13:43:49 -   1.29
  @@ -1103,7 +1103,6 @@
   // Identify the appBase of the owning Host of this Context (if any)
   String appBase = null;
   File appBaseDir = null;
  -String appBasePath = null;
   if (context.getParent() instanceof Host) {
   appBase = ((Host) context.getParent()).getAppBase();
   appBaseDir = new File(appBase);
  @@ -,7 +1110,6 @@
   appBaseDir = new File(System.getProperty("catalina.base"),
 appBase);
   }
  -appBasePath = appBaseDir.getCanonicalPath();
   }
   
   // Validate the docBase path of this application
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets ManagerServlet.java

2002-09-18 Thread remm

remm2002/09/18 07:00:44

  Modified:catalina/src/share/org/apache/catalina/servlets
ManagerServlet.java
  Log:
  - Fix bug 12521. The check is reversed.
  - Submitted by Gabriele Garuglieri 
  
  Revision  ChangesPath
  1.28  +6 -7  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java
  
  Index: ManagerServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- ManagerServlet.java   12 Sep 2002 07:07:27 -  1.27
  +++ ManagerServlet.java   18 Sep 2002 14:00:44 -  1.28
  @@ -502,9 +502,8 @@
   return;
   }
   String displayPath = path;
  -if (displayPath.equals("")) {
  -displayPath = "/";
  -}
  +if( path.equals("/") )
  +path = "";
   String basename = null;
   if (path.equals("")) {
   basename = "_";
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets ManagerServlet.java HTMLManagerServlet.java

2002-09-09 Thread amyroh

amyroh  2002/09/09 20:31:16

  Modified:catalina/src/share/org/apache/catalina/servlets
ManagerServlet.java HTMLManagerServlet.java
  Log:
  Fix the output character encoding of servlet response to be specified in
  accordance with the default locale of the server.
  
  Fix for Bugzilla 10910.  Patch submitted by Kan Ogawa <[EMAIL PROTECTED]>.
  
  Revision  ChangesPath
  1.26  +9 -4  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java
  
  Index: ManagerServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- ManagerServlet.java   29 Aug 2002 14:01:19 -  1.25
  +++ ManagerServlet.java   10 Sep 2002 03:31:16 -  1.26
  @@ -74,6 +74,7 @@
   import java.net.URL;
   import java.util.Enumeration;
   import java.util.Iterator;
  +import java.util.Locale;
   import java.util.jar.JarEntry;
   import java.util.jar.JarFile;
   import javax.naming.Binding;
  @@ -330,6 +331,8 @@
   
   // Prepare our output writer to generate the response message
   response.setContentType("text/plain");
  + Locale locale = Locale.getDefault();
  + response.setLocale(locale);
   PrintWriter writer = response.getWriter();
   
   // Process the requested command (note - "/deploy" is not listed here)
  @@ -393,6 +396,8 @@
   
   // Prepare our output writer to generate the response message
   response.setContentType("text/plain");
  + Locale locale = Locale.getDefault();
  + response.setLocale(locale);
   PrintWriter writer = response.getWriter();
   
   // Process the requested command
  
  
  
  1.10  +7 -4  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/HTMLManagerServlet.java
  
  Index: HTMLManagerServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/HTMLManagerServlet.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- HTMLManagerServlet.java   29 Aug 2002 14:01:19 -  1.9
  +++ HTMLManagerServlet.java   10 Sep 2002 03:31:16 -  1.10
  @@ -70,6 +70,7 @@
   import java.text.MessageFormat;
   import java.util.Date;
   import java.util.Iterator;
  +import java.util.Locale;
   import java.util.Map;
   import java.util.TreeMap;
   import javax.servlet.ServletException;
  @@ -127,6 +128,8 @@
   
   // Prepare our output writer to generate the response message
   response.setContentType("text/html");
  + Locale locale = Locale.getDefault();
  + response.setLocale(locale);
   PrintWriter writer = response.getWriter();
   
   // Process the requested command
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets ManagerServlet.java

2002-05-31 Thread remm

remm2002/05/31 14:08:03

  Modified:catalina/src/share/org/apache/catalina/servlets
ManagerServlet.java
  Log:
  - Save configuration when undeploying.
  
  Revision  ChangesPath
  1.24  +15 -4 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java
  
  Index: ManagerServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- ManagerServlet.java   24 May 2002 18:01:50 -  1.23
  +++ ManagerServlet.java   31 May 2002 21:08:03 -  1.24
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
 1.23 2002/05/24 18:01:50 remm Exp $
  - * $Revision: 1.23 $
  - * $Date: 2002/05/24 18:01:50 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
 1.24 2002/05/31 21:08:03 remm Exp $
  + * $Revision: 1.24 $
  + * $Date: 2002/05/31 21:08:03 $
*
* 
*
  @@ -198,7 +198,7 @@
* 
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.23 $ $Date: 2002/05/24 18:01:50 $
  + * @version $Revision: 1.24 $ $Date: 2002/05/31 21:08:03 $
*/
   
   public class ManagerServlet
  @@ -1130,6 +1130,17 @@
   log("ManagerServlet.undeploy[" + displayPath + "]", t);
   writer.println(sm.getString("managerServlet.exception",
   t.toString()));
  +}
  +
  +// Saving configuration
  +Server server = ServerFactory.getServer();
  +if ((server != null) && (server instanceof StandardServer)) {
  +try {
  +((StandardServer) server).store();
  +} catch (Exception e) {
  +writer.println(sm.getString("managerServlet.saveFail",
  +e.getMessage()));
  +}
   }
   
   }
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets ManagerServlet.java

2002-05-24 Thread remm

remm02/05/24 11:01:50

  Modified:catalina/src/share/org/apache/catalina/servlets
ManagerServlet.java
  Log:
  - Improve the type filtering to use instanceof.
  
  Revision  ChangesPath
  1.23  +21 -9 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java
  
  Index: ManagerServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- ManagerServlet.java   24 May 2002 17:41:48 -  1.22
  +++ ManagerServlet.java   24 May 2002 18:01:50 -  1.23
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
 1.22 2002/05/24 17:41:48 remm Exp $
  - * $Revision: 1.22 $
  - * $Date: 2002/05/24 17:41:48 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
 1.23 2002/05/24 18:01:50 remm Exp $
  + * $Revision: 1.23 $
  + * $Date: 2002/05/24 18:01:50 $
*
* 
*
  @@ -198,7 +198,7 @@
* 
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.22 $ $Date: 2002/05/24 17:41:48 $
  + * @version $Revision: 1.23 $ $Date: 2002/05/24 18:01:50 $
*/
   
   public class ManagerServlet
  @@ -805,7 +805,19 @@
   writer.println(sm.getString("managerServlet.resourcesAll"));
   }
   
  -printResources(writer, "", global, type);
  +Class clazz = null;
  +try {
  +if (type != null) {
  +clazz = Class.forName(type);
  +}
  +} catch (Throwable t) {
  +log("ManagerServlet.resources[" + type + "]", t);
  +writer.println(sm.getString("managerServlet.exception",
  +t.toString()));
  +return;
  +}
  +
  +printResources(writer, "", global, type, clazz);
   
   }
   
  @@ -815,7 +827,7 @@
*/
   protected void printResources(PrintWriter writer, String prefix,
 javax.naming.Context namingContext,
  -  String type) {
  +  String type, Class clazz) {
   
   try {
   NamingEnumeration items = namingContext.listBindings("");
  @@ -824,10 +836,10 @@
   if (item.getObject() instanceof javax.naming.Context) {
   printResources
   (writer, prefix + item.getName() + "/",
  - (javax.naming.Context) item.getObject(), type);
  + (javax.naming.Context) item.getObject(), type, clazz);
   } else {
  -if ((type != null) &&
  -(!type.equals(item.getClassName( {
  +if ((clazz != null) &&
  +(!(clazz.isInstance(item.getObject() {
   continue;
   }
   writer.print(prefix + item.getName());
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets ManagerServlet.java

2002-05-24 Thread remm

remm02/05/24 10:41:48

  Modified:catalina/src/share/org/apache/catalina/servlets
ManagerServlet.java
  Log:
  - Handle resources nested in subcontexts.
  
  Revision  ChangesPath
  1.22  +34 -15
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java
  
  Index: ManagerServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- ManagerServlet.java   21 May 2002 01:36:36 -  1.21
  +++ ManagerServlet.java   24 May 2002 17:41:48 -  1.22
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
 1.21 2002/05/21 01:36:36 remm Exp $
  - * $Revision: 1.21 $
  - * $Date: 2002/05/21 01:36:36 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
 1.22 2002/05/24 17:41:48 remm Exp $
  + * $Revision: 1.22 $
  + * $Date: 2002/05/24 17:41:48 $
*
* 
*
  @@ -76,8 +76,8 @@
   import java.util.Iterator;
   import java.util.jar.JarEntry;
   import java.util.jar.JarFile;
  +import javax.naming.Binding;
   import javax.naming.InitialContext;
  -import javax.naming.NameClassPair;
   import javax.naming.NamingEnumeration;
   import javax.naming.NamingException;
   import javax.naming.directory.DirContext;
  @@ -198,7 +198,7 @@
* 
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.21 $ $Date: 2002/05/21 01:36:36 $
  + * @version $Revision: 1.22 $ $Date: 2002/05/24 17:41:48 $
*/
   
   public class ManagerServlet
  @@ -804,19 +804,38 @@
   } else {
   writer.println(sm.getString("managerServlet.resourcesAll"));
   }
  +
  +printResources(writer, "", global, type);
  +
  +}
  +
  +
  +/**
  + * List the resources of the given context.
  + */
  +protected void printResources(PrintWriter writer, String prefix,
  +  javax.naming.Context namingContext,
  +  String type) {
  +
   try {
  -NamingEnumeration items = global.list("");
  +NamingEnumeration items = namingContext.listBindings("");
   while (items.hasMore()) {
  -NameClassPair item = (NameClassPair) items.next();
  -if ((type != null) &&
  -(!type.equals(item.getClassName( {
  -continue;
  +Binding item = (Binding) items.next();
  +if (item.getObject() instanceof javax.naming.Context) {
  +printResources
  +(writer, prefix + item.getName() + "/",
  + (javax.naming.Context) item.getObject(), type);
  +} else {
  +if ((type != null) &&
  +(!type.equals(item.getClassName( {
  +continue;
  +}
  +writer.print(prefix + item.getName());
  +writer.print(':');
  +writer.print(item.getClassName());
  +// Do we want a description if available?
  +writer.println();
   }
  -writer.print(item.getName());
  -writer.print(':');
  -writer.print(item.getClassName());
  -// Do we want a description if available?
  -writer.println();
   }
   } catch (Throwable t) {
   log("ManagerServlet.resources[" + type + "]", t);
  
  
  

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets ManagerServlet.java

2002-05-06 Thread Glenn Nielsen



[EMAIL PROTECTED] wrote:

> On 4 May 2002 [EMAIL PROTECTED] wrote:
> 
> 
>>  Make the "/deploy" command recognize a "META-INF/context.xml" file embedded
>>  inside the WAR, and process it as a context configuration file.  This allows
>>  deployment tool clients to customize the configuration of a webapp with
>>  exactly the same degree of freedom as those that use the "/install" command,
>>  with the added benefit of being able to deploy onto a Tomcat instance
>>  running on a different server.
>>
> 
> This is a very dangerous path... Having server-config info in the webapp 
> is extremely dangerous, it may (easily) break the sandbox. 
> 
> Unless there's something I'm missing, context.xml will allow loading of
> valves and other modules that have access to the server internal objects.
> This is a huge security hole.
> 
> Well, having the config files in webapps/ is dangerous too - IMHO 
> all potentially dangerous configs should be in conf/, since webapps
> may be writtable to more groups. But this is far worse.
> 
> At least add a check to disable this if a security manager is present. 
> 
> 


I agree, I added a Host config flag called "deployXML" which can disable this
for context.xml files in the webapps dir.  As long as this flag works for
/META-INF/context.xml we are covered.


Regards,

Glenn


--
Glenn Nielsen [EMAIL PROTECTED] | /* Spelin donut madder|
MOREnet System Programming   |  * if iz ina coment.  |
Missouri Research and Education Network  |  */   |
--


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets ManagerServlet.java

2002-05-04 Thread craigmcc

craigmcc02/05/04 11:37:50

  Modified:catalina/src/share/org/apache/catalina/servlets
ManagerServlet.java
  Log:
  Make the "/deploy" command recognize a "META-INF/context.xml" file embedded
  inside the WAR, and process it as a context configuration file.  This allows
  deployment tool clients to customize the configuration of a webapp with
  exactly the same degree of freedom as those that use the "/install" command,
  with the added benefit of being able to deploy onto a Tomcat instance
  running on a different server.
  
  Revision  ChangesPath
  1.20  +193 -34   
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java
  
  Index: ManagerServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- ManagerServlet.java   8 Apr 2002 17:46:08 -   1.19
  +++ ManagerServlet.java   4 May 2002 18:37:49 -   1.20
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
 1.19 2002/04/08 17:46:08 craigmcc Exp $
  - * $Revision: 1.19 $
  - * $Date: 2002/04/08 17:46:08 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
 1.20 2002/05/04 18:37:49 craigmcc Exp $
  + * $Revision: 1.20 $
  + * $Date: 2002/05/04 18:37:49 $
*
* 
*
  @@ -74,6 +74,8 @@
   import java.net.URL;
   import java.util.Enumeration;
   import java.util.Iterator;
  +import java.util.jar.JarEntry;
  +import java.util.jar.JarFile;
   import javax.naming.InitialContext;
   import javax.naming.NameClassPair;
   import javax.naming.NamingEnumeration;
  @@ -196,7 +198,7 @@
* 
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.19 $ $Date: 2002/04/08 17:46:08 $
  + * @version $Revision: 1.20 $ $Date: 2002/05/04 18:37:49 $
*/
   
   public class ManagerServlet
  @@ -219,6 +221,14 @@
   
   
   /**
  + * File object representing the directory into which the deploy() command
  + * will store the WAR and context configuration files that have been
  + * uploaded.
  + */
  +protected File deployed = null;
  +
  +
  +/**
* The Deployer container that contains our own web application's Context,
* along with the associated Contexts for web applications that we
* are managing.
  @@ -435,6 +445,10 @@
   global = ((StandardServer) server).getGlobalNamingContext();
   }
   
  +// Calculate the directory into which we will be deploying applications
  +deployed = (File) getServletContext().getAttribute
  +("javax.servlet.context.tempdir");
  +
   // Log debugging messages as necessary
   if (debug >= 1) {
   log("init: Associated with Deployer '" +
  @@ -488,46 +502,52 @@
   }
   
   // Upload the web application archive to a local WAR file
  -File tempDir = (File) getServletContext().getAttribute
  -("javax.servlet.context.tempdir");
  -File localWar = new File(tempDir, basename + ".war");
  -localWar.delete();
  +File localWar = new File(deployed, basename + ".war");
  +if (debug >= 2) {
  +log("Uploading WAR file to " + localWar);
  +}
   try {
  -if (debug >= 2) {
  -log("Uploading WAR file to " + localWar);
  -}
  -ServletInputStream istream = request.getInputStream();
  -BufferedOutputStream ostream =
  -new BufferedOutputStream(new FileOutputStream(localWar), 1024);
  -byte buffer[] = new byte[1024];
  -while (true) {
  -int n = istream.read(buffer);
  -if (n < 0) {
  -break;
  -}
  -ostream.write(buffer, 0, n);
  -}
  -ostream.flush();
  -ostream.close();
  -istream.close();
  +uploadWar(request, localWar);
   } catch (IOException e) {
   log("managerServlet.upload[" + displayPath + "]", e);
   writer.println(sm.getString("managerServlet.exception",
   e.toString()));
  -localWar.delete();
   return;
   }
   
  -// Deploy the local WAR file
  +// Extract the nested context deployment file (if any)
  +File localXml = new File(deployed, basename + ".xml");
  +if (debug >= 2) {
  +log("Extracting XML file to " + localXml);
  +}
   try {
  -deployer.install(path,
  -   

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets ManagerServlet.java

2002-03-12 Thread craigmcc

craigmcc02/03/12 17:26:49

  Modified:catalina/src/share/org/apache/catalina/core
StandardHostDeployer.java
   catalina/src/share/org/apache/catalina/loader
StandardClassLoader.java
   catalina/src/share/org/apache/catalina/servlets
ManagerServlet.java
  Log:
  Remove obsolete JAR related imports from StandardHostDeployer and
  ManagerServlet.  Enhance JAR handling in StandardClassLoader to close a
  JAR file even if an exception occurs.
  
  Revision  ChangesPath
  1.7   +4 -7  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java
  
  Index: StandardHostDeployer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- StandardHostDeployer.java 1 Mar 2002 16:44:32 -   1.6
  +++ StandardHostDeployer.java 13 Mar 2002 01:26:49 -  1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java,v
 1.6 2002/03/01 16:44:32 glenn Exp $
  - * $Revision: 1.6 $
  - * $Date: 2002/03/01 16:44:32 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHostDeployer.java,v
 1.7 2002/03/13 01:26:49 craigmcc Exp $
  + * $Revision: 1.7 $
  + * $Date: 2002/03/13 01:26:49 $
*
* 
*
  @@ -70,11 +70,8 @@
   import java.io.FileOutputStream;
   import java.io.InputStream;
   import java.io.IOException;
  -import java.net.JarURLConnection;
   import java.net.URL;
   import java.util.Enumeration;
  -import java.util.jar.JarEntry;
  -import java.util.jar.JarFile;
   import org.apache.catalina.Container;
   import org.apache.catalina.Context;
   import org.apache.catalina.Deployer;
  @@ -94,7 +91,7 @@
* StandardHost implementation class.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.6 $ $Date: 2002/03/01 16:44:32 $
  + * @version $Revision: 1.7 $ $Date: 2002/03/13 01:26:49 $
*/
   
   public class StandardHostDeployer implements Deployer {
  
  
  
  1.26  +11 -7 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardClassLoader.java
  
  Index: StandardClassLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardClassLoader.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- StandardClassLoader.java  9 Nov 2001 17:59:16 -   1.25
  +++ StandardClassLoader.java  13 Mar 2002 01:26:49 -  1.26
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardClassLoader.java,v
 1.25 2001/11/09 17:59:16 remm Exp $
  - * $Revision: 1.25 $
  - * $Date: 2001/11/09 17:59:16 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardClassLoader.java,v
 1.26 2002/03/13 01:26:49 craigmcc Exp $
  + * $Revision: 1.26 $
  + * $Date: 2002/03/13 01:26:49 $
*
* 
*
  @@ -112,7 +112,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
  - * @version $Revision: 1.25 $ $Date: 2001/11/09 17:59:16 $
  + * @version $Revision: 1.26 $ $Date: 2002/03/13 01:26:49 $
*/
   
   public class StandardClassLoader
  @@ -1063,8 +1063,8 @@
   
   // Validate the manifest of a JAR file repository
   if (!repository.endsWith(File.separator)) {
  +JarFile jarFile = null;
   try {
  -JarFile jarFile = null;
   Manifest manifest = null;
   if (repository.startsWith("jar:")) {
   URL url = new URL(null, repository, streamHandler);
  @@ -1104,12 +1104,16 @@
   required.add(extensions.next());
   }
   }
  -if (jarFile != null)
  -jarFile.close();
   } catch (Throwable t) {
   t.printStackTrace();
   throw new IllegalArgumentException
   ("addRepositoryInternal: " + t);
  +} finally {
  +if (jarFile != null) {
  +try {
  +jarFile.close();
  +} catch (Throwable t) {}
  +}
   }
   }
   
  
  
  
  1.18  +4 -6  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java
  
  Index: ManagerServlet.java
  

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets ManagerServlet.java

2002-02-27 Thread craigmcc

craigmcc02/02/27 22:10:55

  Modified:catalina/src/share/org/apache/catalina/servlets
ManagerServlet.java
  Log:
  Refine the mechanism used for the /deploy command so that undeploy/redeploy
  works reliably.
  
  Revision  ChangesPath
  1.15  +61 -114   
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java
  
  Index: ManagerServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ManagerServlet.java   27 Feb 2002 22:43:56 -  1.14
  +++ ManagerServlet.java   28 Feb 2002 06:10:55 -  1.15
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
 1.14 2002/02/27 22:43:56 craigmcc Exp $
  - * $Revision: 1.14 $
  - * $Date: 2002/02/27 22:43:56 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
 1.15 2002/02/28 06:10:55 craigmcc Exp $
  + * $Revision: 1.15 $
  + * $Date: 2002/02/28 06:10:55 $
*
* 
*
  @@ -182,7 +182,7 @@
* 
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.14 $ $Date: 2002/02/27 22:43:56 $
  + * @version $Revision: 1.15 $ $Date: 2002/02/28 06:10:55 $
*/
   
   public class ManagerServlet
  @@ -432,6 +432,7 @@
   log("deploy: Deploying web application at '" + path + "'");
   }
   
  +// Validate the requested context path
   if ((path == null) || (!path.startsWith("/") && path.equals(""))) {
   writer.println(sm.getString("managerServlet.invalidPath", path));
   return;
  @@ -440,19 +441,30 @@
   if (displayPath.equals("")) {
   displayPath = "/";
   }
  +String basename = null;
  +if (path.equals("")) {
  +basename = "_";
  +} else {
  +basename = path.substring(1);
  +}
  +if (deployer.findDeployedApp(path) != null) {
  +writer.println
  +(sm.getString("managerServlet.alreadyContext", displayPath));
  +return;
  +}
   
   // Upload the web application archive to a temporary JAR file
   File tempDir = (File) getServletContext().getAttribute
   ("javax.servlet.context.tempdir");
  -File tempJar = new File(tempDir, "webapp.war");
  -tempJar.delete();
  +File localWar = new File(tempDir, basename + ".war");
  +localWar.delete();
   try {
   if (debug >= 2) {
  -log("Uploading WAR file to " + tempJar);
  +log("Uploading WAR file to " + localWar);
   }
   ServletInputStream istream = request.getInputStream();
   BufferedOutputStream ostream =
  -new BufferedOutputStream(new FileOutputStream(tempJar), 1024);
  +new BufferedOutputStream(new FileOutputStream(localWar), 1024);
   byte buffer[] = new byte[1024];
   while (true) {
   int n = istream.read(buffer);
  @@ -468,99 +480,24 @@
   log("managerServlet.upload[" + displayPath + "]", e);
   writer.println(sm.getString("managerServlet.exception",
   e.toString()));
  -tempJar.delete();
  +localWar.delete();
   return;
   }
   
  -// Validate that the context path and directory name are available
  -if (deployer.findDeployedApp(path) != null) {
  -writer.println
  -(sm.getString("managerServlet.alreadyContext", displayPath));
  -tempJar.delete();
  -return;
  -}
  -if (!(context.getParent() instanceof Host)) {
  -writer.println(sm.getString("managerServlet.noAppBase",
  -displayPath));
  -tempJar.delete();
  -return;
  -}
  -String appBase = ((Host) context.getParent()).getAppBase();
  -File appBaseDir = new File(appBase);
  -if (!appBaseDir.isAbsolute()) {
  -appBaseDir = new File(System.getProperty("catalina.base"),
  -  appBase);
  -}
  -String docBase = displayPath.substring(1);
  -if (docBase.length() < 1) {
  -docBase = "_";
  -}
  -File docBaseDir = new File(appBaseDir, docBase);
  -if (docBaseDir.exists()) {
  -writer.println(sm.getString("managerServlet.alreadyDocBase",
  -docBaseDir));
  -tempJar.delete();
 

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets ManagerServlet.java

2001-03-25 Thread glenn

glenn   01/03/25 19:23:35

  Modified:catalina/src/share/org/apache/catalina/servlets
ManagerServlet.java
  Log:
  Improve webapp unpack WAR file behaviour and enhance manager servlet
  
  Revision  ChangesPath
  1.4   +242 -46   
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java
  
  Index: ManagerServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ManagerServlet.java   2001/01/03 02:20:46 1.3
  +++ ManagerServlet.java   2001/03/26 03:23:35 1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
 1.3 2001/01/03 02:20:46 craigmcc Exp $
  - * $Revision: 1.3 $
  - * $Date: 2001/01/03 02:20:46 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
 1.4 2001/03/26 03:23:35 glenn Exp $
  + * $Revision: 1.4 $
  + * $Date: 2001/03/26 03:23:35 $
*
* 
*
  @@ -78,6 +78,7 @@
   import org.apache.catalina.Deployer;
   import org.apache.catalina.HttpRequest;
   import org.apache.catalina.HttpResponse;
  +import org.apache.catalina.Session;
   import org.apache.catalina.Wrapper;
   import org.apache.catalina.util.StringManager;
   
  @@ -94,19 +95,48 @@
* The following actions and parameters (starting after the servlet path)
* are supported:
* 
  - * /list - Return a list of the context paths of all currently
  - * running web applications in this virtual host.
  - * /deploy?path=/xxx&war={war-url} - Deploy a new web application
  - * attached to context path /xxx, based on the contents of
  - * the web application archive found at the specified URL.
  + * /install?path=/xxx&war={war-url} - Install and start a new
  + * web application attached to context path /xxx, based
  + * on the contents of the web application archive found at the
  + * specified URL.
  + * /list - List the context paths of all currently installed web
  + * applications for this virtual host.  Each context will be listed with
  + * the following format path:status:sessions.
  + * Where path is the context path.  Status is either running or stopped.
  + * Sessions is the number of active Sessions.
* /reload?path=/xxx - Reload the Java classes and resources for
* the application at the specified path, but do not reread the web.xml
  - * configuration files.
  - * /undeploy?path=/xxx - Remove any web application attached to
  - * context path /xxx from this virtual host.
  + * configuration files.
  + * /remove?path=/xxx - Shutdown and remove the web application
  + * attached to context path /xxx for this virtual host.
  + * /sessions?path=/xxx - List session information about the web
  + * application attached to context path /xxx for this
  + * virtual host.
  + * /start?path=/xxx - Start the web application attached to
  + * context path /xxx for this virtual host.
  + * /stop?path=/xxx - Stop the web application attached to
  + * context path /xxx for this virtual host.
* 
  + * Use path=/ for the ROOT context.
  + * The syntax of the URL for a web application archive must conform to one
  + * of the following patterns to be successfully deployed:
  + * 
  + * file:/absolute/path/to/a/directory - You can specify the absolute
  + * path of a directory that contains the unpacked version of a web
  + * application.  This directory will be attached to the context path you
  + * specify without any changes.
  + * jar:file:/absolute/path/to/a/warfile.war!/ - You can specify a
  + * URL to a local web application archive file.  The syntax must conform to
  + * the rules specified by the JarURLConnection class for a
  + * reference to an entire JAR file.
  + * jar:http://hostname:port/path/to/a/warfile.war!/ - You can specify
  + * a URL to a remote (HTTP-accessible) web application archive file.  The
  + * syntax must conform to the rules specified by the
  + * JarURLConnection class for a reference to an entire
  + * JAR file.
  + * 
* 
  - * NOTE - Attempting to reload or undeploy the application containing
  + * NOTE - Attempting to reload or remove the application containing
* this servlet itself will not succeed.  Therefore, this servlet should
* generally be deployed as a separate web application within the virtual host
* to be managed.
  @@ -123,7 +153,7 @@
* 
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.3 $ $Date: 2001/01/03 02:20:46 $
  + * @version $Revision: 1.4 $ $Date: 2001/03/26 03:23:35 $
*/
   
   public final class M

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets ManagerServlet.java

2001-01-02 Thread craigmcc

craigmcc01/01/02 18:20:46

  Modified:catalina/src/share/org/apache/catalina/servlets
ManagerServlet.java
  Log:
  Support management of the ROOT web application (i.e. the one mapped to an
  empty string as the context path).
  
  Revision  ChangesPath
  1.3   +10 -7 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java
  
  Index: ManagerServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ManagerServlet.java   2000/10/05 02:30:22 1.2
  +++ ManagerServlet.java   2001/01/03 02:20:46 1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
 1.2 2000/10/05 02:30:22 craigmcc Exp $
  - * $Revision: 1.2 $
  - * $Date: 2000/10/05 02:30:22 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/ManagerServlet.java,v
 1.3 2001/01/03 02:20:46 craigmcc Exp $
  + * $Revision: 1.3 $
  + * $Date: 2001/01/03 02:20:46 $
*
* 
*
  @@ -123,7 +123,7 @@
* 
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.2 $ $Date: 2000/10/05 02:30:22 $
  + * @version $Revision: 1.3 $ $Date: 2001/01/03 02:20:46 $
*/
   
   public final class ManagerServlet
  @@ -273,7 +273,8 @@
log("deploy: Deploying web application at '" + path +
"' from '" + war + "'");
   
  -if ((path == null) || !path.startsWith("/")) {
  +if ((path == null) ||
  +(!path.startsWith("/") && !path.equals(""))) {
   writer.println(sm.getString("managerServlet.invalidPath", path));
   return;
   }
  @@ -332,7 +333,8 @@
   if (debug >= 1)
log("restart: Reloading web application at '" + path + "'");
   
  -if ((path == null) || !path.startsWith("/")) {
  +if ((path == null) ||
  +(!path.startsWith("/") && !path.equals(""))) {
   writer.println(sm.getString("managerServlet.invalidPath", path));
   return;
   }
  @@ -365,7 +367,8 @@
   if (debug >= 1)
log("undeploy: Undeploying web application at '" + path + "'");
   
  -if ((path == null) || !path.startsWith("/")) {
  +if ((path == null) ||
  +(!path.startsWith("/") && !path.equals(""))) {
   writer.println(sm.getString("managerServlet.invalidPath", path));
   return;
   }
  
  
  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]