cvs commit: jakarta-tomcat/src/doc index.html

2000-11-17 Thread glenn

glenn   00/11/17 12:50:06

  Modified:src/doc  Tag: tomcat_32 index.html
  Log:
  Update link
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.5.2.4   +2 -2  jakarta-tomcat/src/doc/index.html
  
  Index: index.html
  ===
  RCS file: /home/cvs/jakarta-tomcat/src/doc/index.html,v
  retrieving revision 1.5.2.3
  retrieving revision 1.5.2.4
  diff -u -r1.5.2.3 -r1.5.2.4
  --- index.html2000/11/06 04:53:48 1.5.2.3
  +++ index.html2000/11/17 20:50:05 1.5.2.4
  @@ -1,7 +1,7 @@
   
   html
 head
  -!-- $Id: index.html,v 1.5.2.3 2000/11/06 04:53:48 craigmcc Exp $ --
  +!-- $Id: index.html,v 1.5.2.4 2000/11/17 20:50:05 glenn Exp $ --
   !-- Copyright 1999, Apache Software Foundation --
   meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
   link rel="stylesheet" href="uguide/style.css"
  @@ -39,7 +39,7 @@
 configure, and deploy Tomcat./li
   lia href="JDBCRealm.howto"JDBC Realms/a - Use a set of
 configurable tables inside an RDBMS to store validation data./li
  -lia href="uguide/tomcat_security.txt"Using the Java SecurityManager with 
Tomcat/a
  +lia href="uguide/tomcat-security.html"Using the Java SecurityManager with 
Tomcat/a
 - Use of a SecurityManager while running Tomcat can protect your server
 from Trojan servlets, JSPs, JSP beans, and tag libraries./li
   lia href="Tomcat-Workers-HowTo.html"Tomcat Workers/a - How to work
  
  
  



cvs commit: jakarta-tomcat/src/shell tomcat.sh

2000-11-17 Thread glenn

glenn   00/11/17 14:05:50

  Modified:src/shell Tag: tomcat_32 tomcat.sh
  Log:
  Remove current directory from CLASSPATH
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.17.2.1  +7 -4  jakarta-tomcat/src/shell/tomcat.sh
  
  Index: tomcat.sh
  ===
  RCS file: /home/cvs/jakarta-tomcat/src/shell/tomcat.sh,v
  retrieving revision 1.17
  retrieving revision 1.17.2.1
  diff -u -r1.17 -r1.17.2.1
  --- tomcat.sh 2000/05/26 18:55:33 1.17
  +++ tomcat.sh 2000/11/17 22:05:50 1.17.2.1
  @@ -1,6 +1,6 @@
   #!/bin/sh
   #
  -# $Id: tomcat.sh,v 1.17 2000/05/26 18:55:33 costin Exp $
  +# $Id: tomcat.sh,v 1.17.2.1 2000/11/17 22:05:50 glenn Exp $
   
   # Shell script to start and stop the server
   
  @@ -87,12 +87,15 @@
  JAVACMD=$JAVA_HOME/bin/java
   fi
   
  -
   oldCP=$CLASSPATH

  -CLASSPATH=.
  +unset CLASSPATH
   for i in ${TOMCAT_HOME}/lib/* ; do
  -  CLASSPATH=${CLASSPATH}:$i
  +  if [ "$CLASSPATH" != "" ]; then
  +CLASSPATH=${CLASSPATH}:$i
  +  else
  +CLASSPATH=$i
  +  fi
   done
   
   if [ -f ${JAVA_HOME}/lib/tools.jar ] ; then
  
  
  



cvs commit: jakarta-tomcat/src/doc/uguide tomcat-security-unix.html

2000-12-28 Thread glenn

glenn   00/12/28 13:59:19

  Added:   src/doc/uguide Tag: tomcat_32 tomcat-security-unix.html
  Log:
  SecurityManager under unix
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.1.2.1   +197 -0jakarta-tomcat/src/doc/uguide/Attic/tomcat-security-unix.html
  
  
  
  



cvs commit: jakarta-tomcat/src/doc/uguide tomcat-security.html

2000-12-28 Thread glenn

glenn   00/12/28 13:59:35

  Modified:src/doc/uguide Tag: tomcat_32 tomcat-security.html
  Log:
  SecurityManager under unix
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.1.2.2   +2 -168jakarta-tomcat/src/doc/uguide/Attic/tomcat-security.html
  
  Index: tomcat-security.html
  ===
  RCS file: /home/cvs/jakarta-tomcat/src/doc/uguide/Attic/tomcat-security.html,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- tomcat-security.html  2000/11/17 20:44:51 1.1.2.1
  +++ tomcat-security.html  2000/12/28 21:59:34 1.1.2.2
  @@ -1,6 +1,7 @@
   !doctype html public "-//w3c//dtd html 4.0 transitional//en"
   html
   head
  +   titleUsing the Java SecurityManager with Tomcat/title
  meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
  meta name="GENERATOR" content="Mozilla/4.7 [en] (X11; I; SunOS 5.7 i86pc) 
[Netscape]"
   /head
  @@ -23,18 +24,11 @@
   a href="#permissions"Types of Permissions/a/li
   
   li
  -a href="#config"Configuring Tomcat for use with a SecurityManager/a/li
  +a href="tomcat-security-unix.html"Tomcat SecurityManager setup with Unix/a/li
   
   li
  -a href="#start"Starting Tomcat with a SecurityManager/a/li
  -
  -li
   a href="#violation"What happens when the SecurityManager detects a Security
   violation?/a/li
  -
  -li
  -a href="#trouble"Trouble shooting tomcat.policy configuration and Security
  -Violations/a/li
   /ul
   
   h3
  @@ -102,170 +96,10 @@
   were running Tomcat without a SecurityManager.
   brnbsp;
   h3
  -a NAME="config"/aConfiguring Tomcat for use with a SecurityManager/h3
  -btomcat.policy/b
  -pThe security policies implemented by the Java SecurityManager are configured
  -in the btomcat.policy /bfile located in the tomcat conf directory.nbsp;
  -The tomcat.policy file replaces any system java.policy file.nbsp; The
  -tomcat.policy file can be edited by hand or you can use the bpolicytool
  -/bapplication
  -that comes with Java 1.2.
  -pEntries in the tomcat.policy file use the standard java.policy file
  -format as follows:
  -table BORDER=0 
  -tr
  -td
  -pre// Example policy file entry
  -
  -grant [signedBy lt;signer [,codeBase lt;code source] {
  -nbsp;nbsp;nbsp; permission lt;class [lt;name [, lt;action list]];
  -};/pre
  -/td
  -/tr
  -/table
  -The bsignedBy/b and bcodeBase /bentries are optional when granting
  -permissions. Comment lines begin with // and end at a new line.
  -pThe codeBase is in the form of a URL and for a file URL can use the
  -${java.home} and ${tomcat.home} properties which are expanded out to the
  -directory paths defined for them.
  -pDefault tomcat.policy file
  -table BORDER=0 
  -tr
  -td
  -pre// Permissions for tomcat.
  -
  -// javac needs this
  -grant codeBase "file:${java.home}/lib/-" {
  -nbsp; permission java.security.AllPermission;
  -};
  -
  -// Tomcat gets all permissions
  -grant codeBase "file:${tomcat.home}/lib/-" {
  -nbsp; permission java.security.AllPermission;
  -};
  -
  -grant codeBase "file:${tomcat.home}/classes/-" {
  -nbsp; permission java.security.AllPermission;
  -};
  -
  -// Example webapp policy
  -// By default we grant read access on webapp dir
  -// and read of the line.separator PropertyPermission
  -grant codeBase "file:${tomcat.home}/webapps/examples" {
  -nbsp; permission java.net.SocketPermission "localhost:1024-","listen";
  -nbsp; permission java.util.PropertyPermission "*","read";
  -};/pre
  -/td
  -/tr
  -/table
  -
  -pHere is an example where in addition to the above, we want to grant
  -the examples web application the ability to connect to the localhost smtp
  -port so that it can send mail.
  -table BORDER=0 
  -tr
  -td
  -pregrant codeBase "file:${tomcat.home}/webapps/examples" {
  -nbsp; permission java.net.SocketPermission "localhost:25","connect";
  -nbsp; permission java.net.SocketPermission "localhost:1024","listen";
  -nbsp; permission java.util.PropertyPermission "*","read";
  -};/pre
  -/td
  -/tr
  -/table
  -Now what if we wanted to give all contexts not configured by their own
  -grant entry some default permissions in addition to what Tomcat assigns
  -by default.
  -table BORDER=0 
  -tr
  -td
  -pregrant {
  -nbsp; permission java.net.SocketPermission "localhost:1024","listen";
  -nbsp; permission java.util.PropertyPermission "*","read";
  -};/pre
  -/td
  -/tr
  -/table
  -Finally, a more complex tomcat.policy file.nbsp; In this case we are using
  -Tomcat as an app server for a number of remote web servers.nbsp; We want
  -to lim

cvs commit: jakarta-tomcat/src/etc tomcat.policy

2000-12-28 Thread glenn

glenn   00/12/28 14:11:01

  Modified:src/etc  Tag: tomcat_32 tomcat.policy
  Log:
  Updated for default permissions
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.5.2.1   +7 -6  jakarta-tomcat/src/etc/tomcat.policy
  
  Index: tomcat.policy
  ===
  RCS file: /home/cvs/jakarta-tomcat/src/etc/tomcat.policy,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- tomcat.policy 2000/06/15 18:49:52 1.5
  +++ tomcat.policy 2000/12/28 22:11:00 1.5.2.1
  @@ -1,4 +1,4 @@
  -// Additional permissions for tomcat.
  +// Permissions for tomcat.
   
   // javac
   grant codeBase "file:${java.home}/../lib/-" {
  @@ -14,11 +14,12 @@
permission java.security.AllPermission;
   };
   
  -// Example webapp policy 
  -// By default we grant read access on webapp dir and
  -// write in workdir
  +// Example webapp policy
  +// By default Tomcat grants read access on webapp dir and read of the
  +// line.separator, path.separator, and file.separator PropertyPermissions. 
  +// Any permissions you grant here are in addition to the default.
   grant codeBase "file:${tomcat.home}/webapps/examples" {
  -  permission java.net.SocketPermission "localhost:1024-", "listen";
  -  permission java.util.PropertyPermission "*", "read";
  +  // Allow the example web application to read all java properties
  +  permission java.util.ProperyPermission "*", "read";
   };
   
  
  
  



cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/context PolicyInterceptor.java

2000-12-28 Thread glenn

glenn   00/12/28 14:12:11

  Modified:src/share/org/apache/tomcat/context Tag: tomcat_32
PolicyInterceptor.java
  Log:
  Updated for default permissions, fix windows default FilePermission
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.3.2.1   +10 -2 
jakarta-tomcat/src/share/org/apache/tomcat/context/PolicyInterceptor.java
  
  Index: PolicyInterceptor.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/context/PolicyInterceptor.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- PolicyInterceptor.java2000/06/23 02:16:18 1.3
  +++ PolicyInterceptor.java2000/12/28 22:12:11 1.3.2.1
  @@ -123,10 +123,18 @@
   {
// Add default read "-" FilePermission for docBase, classes, lib
// Default per context permissions
  - FilePermission fp = new FilePermission(base + "/-", "read");
  + FilePermission fp = new FilePermission(base + File.separator + "-", "read");
if( fp != null )
p.add((Permission)fp);
  - 
  + PropertyPermission pp = new PropertyPermission("line.separator", "read");
  + if( pp != null )
  + p.add((Permission)pp);
  + pp = new PropertyPermission("file.separator", "read");
  + if( pp != null )
  + p.add((Permission)pp);
  + pp = new PropertyPermission("path.separator", "read");
  + if( pp != null )
  + p.add((Permission)pp);
   }
   
   public void contextInit( Context context)
  
  
  



cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/facade RequestDispatcherImpl.java

2000-12-28 Thread glenn

glenn   00/12/28 14:13:51

  Modified:src/share/org/apache/tomcat/facade Tag: tomcat_32
RequestDispatcherImpl.java
  Log:
  If SecurityManager being used, wrap forward() and include() with an 
AccessController.doPrivileged()
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.8.2.6   +55 -0 
jakarta-tomcat/src/share/org/apache/tomcat/facade/Attic/RequestDispatcherImpl.java
  
  Index: RequestDispatcherImpl.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/facade/Attic/RequestDispatcherImpl.java,v
  retrieving revision 1.8.2.5
  retrieving revision 1.8.2.6
  diff -u -r1.8.2.5 -r1.8.2.6
  --- RequestDispatcherImpl.java2000/11/09 21:18:09 1.8.2.5
  +++ RequestDispatcherImpl.java2000/12/28 22:13:50 1.8.2.6
  @@ -64,6 +64,7 @@
   import org.apache.tomcat.util.StringManager;
   import java.io.*;
   import java.util.*;
  +import java.security.*;
   import javax.servlet.*;
   import javax.servlet.http.*;
   
  @@ -138,6 +139,33 @@
   public void forward(ServletRequest request, ServletResponse response)
throws ServletException, IOException
   {
  + if( System.getSecurityManager() != null ) {
  + final ServletRequest req = request;
  + final ServletResponse res = response;
  + try {
  + java.security.AccessController.doPrivileged(
  +new java.security.PrivilegedExceptionAction()
  +{
  +public Object run() throws ServletException, IOException {
  + doForward(req,res);
  +return null;
  + }
  +}   
  + );
  + } catch( PrivilegedActionException pe) {
  + Exception e = pe.getException();
  + if( e.getClass().getName().equals("javax.servlet.ServletException") )
  + throw (ServletException)e;
  + throw (IOException)e;
  + }
  + } else {
  + doForward(request,response);
  + }
  +}
  +
  +private void doForward(ServletRequest request, ServletResponse response)
  +throws ServletException, IOException
  +{
/** We need to find the request/response. The servlet API
 *  guarantees that we will receive the original request as parameter.
 */
  @@ -218,6 +246,33 @@
   
   public void include(ServletRequest request, ServletResponse response)
throws ServletException, IOException
  +{
  +if( System.getSecurityManager() != null ) {
  +final ServletRequest req = request;
  +final ServletResponse res = response;
  +try {
  +java.security.AccessController.doPrivileged(
  +new java.security.PrivilegedExceptionAction()
  +{
  +public Object run() throws ServletException, IOException {
  +doInclude(req,res);
  +return null; 
  +}   
  +}
  +);   
  +} catch( PrivilegedActionException pe) {
  +Exception e = pe.getException();   
  +if( e.getClass().getName().equals("javax.servlet.ServletException") 
)
  +throw (ServletException)e;
  +throw (IOException)e;
  +}
  +} else {
  + doInclude(request,response);
  + }
  +}
  +
  +private void doInclude(ServletRequest request, ServletResponse response)
  +throws ServletException, IOException
   {
   Request realRequest = ((HttpServletRequestFacade)request).
getRealRequest();
  
  
  



cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/util SessionUtil.java

2000-12-28 Thread glenn

glenn   00/12/28 14:15:30

  Modified:src/share/org/apache/tomcat/util Tag: tomcat_32
SessionUtil.java
  Log:
  Fix generateSessionId() so it works with a SecurityManager
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.5.2.3   +26 -5 
jakarta-tomcat/src/share/org/apache/tomcat/util/Attic/SessionUtil.java
  
  Index: SessionUtil.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/Attic/SessionUtil.java,v
  retrieving revision 1.5.2.2
  retrieving revision 1.5.2.3
  diff -u -r1.5.2.2 -r1.5.2.3
  --- SessionUtil.java  2000/11/18 01:34:00 1.5.2.2
  +++ SessionUtil.java  2000/12/28 22:15:29 1.5.2.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/Attic/SessionUtil.java,v 
1.5.2.2 2000/11/18 01:34:00 craigmcc Exp $
  - * $Revision: 1.5.2.2 $
  - * $Date: 2000/11/18 01:34:00 $
  + * $Header: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/util/Attic/SessionUtil.java,v 
1.5.2.3 2000/12/28 22:15:29 glenn Exp $
  + * $Revision: 1.5.2.3 $
  + * $Date: 2000/12/28 22:15:29 $
*
* 
*
  @@ -68,6 +68,7 @@
   import javax.servlet.http.Cookie;
   import org.apache.tomcat.core.*;
   
  +import java.security.*;
   
   /**
* General purpose utilities useful to codeManager/code and
  @@ -75,7 +76,7 @@
*
* @author Craig R. McClanahan
* @author Shai Fultheim [[EMAIL PROTECTED]]
  - * @version $Revision: 1.5.2.2 $ $Date: 2000/11/18 01:34:00 $
  + * @version $Revision: 1.5.2.3 $ $Date: 2000/12/28 22:15:29 $
*/
   
   public final class SessionUtil {
  @@ -177,7 +178,27 @@
* Generate and return a new session identifier.
*/
   public static String generateSessionId(String jsIdent) {
  -return SessionIdGenerator.generateId(jsIdent);
  +/**
  + * When using a SecurityManager and a JSP page or servlet triggers
  + * creation of a new session id it must be performed with the 
  + * Permissions of this class using doPriviledged because the parent
  + * JSP or servlet may not have sufficient Permissions.
  + */
  +if( System.getSecurityManager() != null ) {
  +class doInit implements PrivilegedAction {
  +private String jsIdent;
  +public doInit(String ident) {
  +jsIdent = ident;
  +}   
  +public Object run() {
  +return SessionIdGenerator.generateId(jsIdent);
  +}   
  +}
  +doInit di = new doInit(jsIdent);
  +return (String)AccessController.doPrivileged(di);
  +} else {
  +return SessionIdGenerator.generateId(jsIdent);
  + }
   }
   
   /**
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java

2000-12-29 Thread glenn

glenn   00/12/29 09:38:39

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationDispatcher.java
  Log:
  If SecurityManager being used, wrap forward() and include() with an 
AccessController.doPrivileged()
  
  Revision  ChangesPath
  1.9   +63 -8 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java
  
  Index: ApplicationDispatcher.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ApplicationDispatcher.java2000/10/28 18:56:04 1.8
  +++ ApplicationDispatcher.java2000/12/29 17:38:39 1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.8 2000/10/28 18:56:04 craigmcc Exp $
  - * $Revision: 1.8 $
  - * $Date: 2000/10/28 18:56:04 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.9 2000/12/29 17:38:39 glenn Exp $
  + * $Revision: 1.9 $
  + * $Date: 2000/12/29 17:38:39 $
*
* 
*
  @@ -95,7 +95,7 @@
* codejavax.servlet.ServletResponseWrapper/code.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.8 $ $Date: 2000/10/28 18:56:04 $
  + * @version $Revision: 1.9 $ $Date: 2000/12/29 17:38:39 $
*/
   
   final class ApplicationDispatcher
  @@ -208,9 +208,37 @@
* @exception IOException if an input/output error occurs
* @exception ServletException if a servlet exception occurs
*/
  -public void forward(ServletRequest request, ServletResponse response)
  -throws IOException, ServletException {
   
  +public void forward(ServletRequest request, ServletResponse response)
  +throws ServletException, IOException
  +{
  +if( System.getSecurityManager() != null ) {
  +final ServletRequest req = request;
  +final ServletResponse res = response;
  +try {
  +java.security.AccessController.doPrivileged(
  +new java.security.PrivilegedExceptionAction()
  +{
  +public Object run() throws ServletException, IOException {
  +doForward(req,res);
  +return null;
  +}
  +}
  +);
  +} catch( PrivilegedActionException pe) {
  +Exception e = pe.getException();
  +if( e.getClass().getName().equals("javax.servlet.ServletException") 
)
  +throw (ServletException)e;
  +throw (IOException)e;
  +}
  +} else {
  +doForward(request,response);
  +}
  +}
  + 
  +private void doForward(ServletRequest request, ServletResponse response)
  +throws ServletException, IOException
  +{
// Reset any output that has been buffered, but keep headers/cookies
if (response.isCommitted())
throw new IllegalStateException
  @@ -334,8 +362,35 @@
* @exception ServletException if a servlet exception occurs
*/
   public void include(ServletRequest request, ServletResponse response)
  -throws IOException, ServletException {
  -
  +throws ServletException, IOException
  +{
  +if( System.getSecurityManager() != null ) {
  +final ServletRequest req = request;
  +final ServletResponse res = response;
  +try {
  +java.security.AccessController.doPrivileged(
  +new java.security.PrivilegedExceptionAction()
  +{
  +public Object run() throws ServletException, IOException {
  +doInclude(req,res);
  +return null;   
  +}   
  +}   
  +);  
  +} catch( PrivilegedActionException pe) {
  +Exception e = pe.getException();
  +if( e.getClass().getName().equals("javax.servlet.ServletException") 
)
  +throw (ServletException)e;
  +throw (IOException)e;
  +}
  +} else {
  +doInclude(request,response);
  +}
  +}
  + 
  +private void doInclude(ServletRequest request, ServletResponse response)
  +throws ServletException, IOException
  +{
// Create a wrapped response to use for this request
ServletResponse wresponse = null;
if (response instanceof

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java

2000-12-29 Thread glenn

glenn   00/12/29 12:27:11

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationDispatcher.java
  Log:
  Fixed build, forgot to add some imports
  
  Revision  ChangesPath
  1.10  +6 -5  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java
  
  Index: ApplicationDispatcher.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ApplicationDispatcher.java2000/12/29 17:38:39 1.9
  +++ ApplicationDispatcher.java2000/12/29 20:27:10 1.10
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.9 2000/12/29 17:38:39 glenn Exp $
  - * $Revision: 1.9 $
  - * $Date: 2000/12/29 17:38:39 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.10 2000/12/29 20:27:10 glenn Exp $
  + * $Revision: 1.10 $
  + * $Date: 2000/12/29 20:27:10 $
*
* 
*
  @@ -64,7 +64,8 @@
   
   package org.apache.catalina.core;
   
  -
  +import java.security.AccessController;
  +import java.security.PrivilegedActionException;
   import java.io.IOException;
   import java.io.PrintWriter;
   import javax.servlet.RequestDispatcher;
  @@ -95,7 +96,7 @@
* codejavax.servlet.ServletResponseWrapper/code.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.9 $ $Date: 2000/12/29 17:38:39 $
  + * @version $Revision: 1.10 $ $Date: 2000/12/29 20:27:10 $
*/
   
   final class ApplicationDispatcher
  
  
  

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




cvs commit: jakarta-tomcat/src/shell tomcat.sh

2001-01-10 Thread glenn

glenn   01/01/10 14:55:49

  Modified:src/shell Tag: tomcat_32 tomcat.sh
  Log:
  Fixed startup with -security
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.17.2.2  +3 -1  jakarta-tomcat/src/shell/tomcat.sh
  
  Index: tomcat.sh
  ===
  RCS file: /home/cvs/jakarta-tomcat/src/shell/tomcat.sh,v
  retrieving revision 1.17.2.1
  retrieving revision 1.17.2.2
  diff -u -r1.17.2.1 -r1.17.2.2
  --- tomcat.sh 2000/11/17 22:05:50 1.17.2.1
  +++ tomcat.sh 2001/01/10 22:55:48 1.17.2.2
  @@ -1,6 +1,6 @@
   #!/bin/sh
   #
  -# $Id: tomcat.sh,v 1.17.2.1 2000/11/17 22:05:50 glenn Exp $
  +# $Id: tomcat.sh,v 1.17.2.2 2001/01/10 22:55:48 glenn Exp $
   
   # Shell script to start and stop the server
   
  @@ -122,6 +122,7 @@
 shift 
 echo Using classpath: ${CLASSPATH}
 if [ "$1" = "-security" ] ; then
  +shift
   echo Starting with a SecurityManager
   $JAVACMD $TOMCAT_OPTS -Djava.security.manager 
-Djava.security.policy==${TOMCAT_HOME}/conf/tomcat.policy -Dtomcat.home=${TOMCAT_HOME} 
 org.apache.tomcat.startup.Tomcat "$@" 
 else
  @@ -139,6 +140,7 @@
 shift 
 echo Using classpath: ${CLASSPATH}
 if [ "$1" = "-security" ] ; then
  +shift
   echo Starting with a SecurityManager
   $JAVACMD $TOMCAT_OPTS -Djava.security.manager 
-Djava.security.policy==${TOMCAT_HOME}/conf/tomcat.policy -Dtomcat.home=${TOMCAT_HOME} 
org.apache.tomcat.startup.Tomcat "$@"
 else
  
  
  

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




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup Catalina.java

2001-01-23 Thread glenn

glenn   01/01/23 14:01:20

  Modified:catalina/src/share/org/apache/catalina/startup Catalina.java
  Log:
  Implement SecurityManager
  
  Revision  ChangesPath
  1.13  +23 -9 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Catalina.java
  
  Index: Catalina.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Catalina.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Catalina.java 2001/01/23 05:05:51 1.12
  +++ Catalina.java 2001/01/23 22:01:16 1.13
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Catalina.java,v
 1.12 2001/01/23 05:05:51 remm Exp $
  - * $Revision: 1.12 $
  - * $Date: 2001/01/23 05:05:51 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Catalina.java,v
 1.13 2001/01/23 22:01:16 glenn Exp $
  + * $Revision: 1.13 $
  + * $Date: 2001/01/23 22:01:16 $
*
* 
*
  @@ -70,6 +70,7 @@
   import java.io.OutputStream;
   import java.lang.reflect.InvocationTargetException;
   import java.net.Socket;
  +import java.security.Security;
   import java.util.Stack;
   import org.apache.catalina.Container;
   import org.apache.catalina.Lifecycle;
  @@ -96,7 +97,7 @@
* /u
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.12 $ $Date: 2001/01/23 05:05:51 $
  + * @version $Revision: 1.13 $ $Date: 2001/01/23 22:01:16 $
*/
   
   public class Catalina {
  @@ -484,12 +485,6 @@
   ("addLifecycleListener",
"org.apache.catalina.LifecycleListener"));
   
  -/*
  - mapper.addRule(prefix + "/Loader",
  -mapper.objectCreate
  -("org.apache.catalina.loader.StandardLoader",
  - "className"));
  -*/
   mapper.addRule(prefix + "/Loader",
  new CreateLoaderAction());
mapper.addRule(prefix + "/Loader",
  @@ -647,6 +642,25 @@
   System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
  "org.apache.naming.java.javaURLContextFactory");
   }
  +
  + // If a SecurityManager is being used, set properties for
  + // checkPackageAccess() and checkPackageDefinition
  + if( System.getSecurityManager() != null ) {
  + String access = Security.getProperty("package.access");
  + if( access != null  access.length()  0 )
  + access += ",";
  + else
  + access = "sun.,";
  + Security.setProperty("package.access",
  + access + "org.apache.catalina.,org.apache.jasper.");
  + String definition = Security.getProperty("package.definition");
  + if( definition != null  definition.length()  0 )
  + definition += ",";
  + else
  + definition = "sun.,";
  + Security.setProperty("package.definition",
  + "java.,javax.,org.apache.catalina.,org.apache.jasper.");
  + }
   
// Start the new server
if (server instanceof Lifecycle) {
  
  
  

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




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup ContextConfig.java

2001-01-23 Thread glenn

glenn   01/01/23 14:02:38

  Modified:catalina/src/share/org/apache/catalina/startup
ContextConfig.java
  Log:
  Implement SecurityManager
  
  Revision  ChangesPath
  1.38  +4 -124
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java
  
  Index: ContextConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- ContextConfig.java2001/01/23 05:05:51 1.37
  +++ ContextConfig.java2001/01/23 22:02:36 1.38
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
 1.37 2001/01/23 05:05:51 remm Exp $
  - * $Revision: 1.37 $
  - * $Date: 2001/01/23 05:05:51 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
 1.38 2001/01/23 22:02:36 glenn Exp $
  + * $Revision: 1.38 $
  + * $Date: 2001/01/23 22:02:36 $
*
* 
*
  @@ -68,7 +68,6 @@
   import java.io.File;
   import java.io.FileInputStream;
   import java.io.FileNotFoundException;
  -import java.io.FilePermission;
   import java.io.InputStream;
   import java.io.IOException;
   import java.lang.reflect.InvocationTargetException;
  @@ -76,12 +75,6 @@
   import java.net.JarURLConnection;
   import java.net.MalformedURLException;
   import java.net.URL;
  -import java.security.CodeSource;
  -import java.security.Permission;
  -import java.security.Permissions;
  -import java.security.PermissionCollection;
  -import java.security.Policy;
  -import java.security.ProtectionDomain;
   import java.util.ArrayList;
   import java.util.Enumeration;
   import java.util.MissingResourceException;
  @@ -118,7 +111,7 @@
* of that Context, and the associated defined servlets.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.37 $ $Date: 2001/01/23 05:05:51 $
  + * @version $Revision: 1.38 $ $Date: 2001/01/23 22:02:36 $
*/
   
   public final class ContextConfig
  @@ -766,116 +759,6 @@
   
   
   /**
  - * Configure permissions for this web application if we are running
  - * under the control of a security manager.
  - */
  -private void permissionsConfig() {
  -
  -// Has a security manager been installed?
  -SecurityManager securityManager = System.getSecurityManager();
  -if (securityManager == null)
  -return;
  -
  -// Refresh the standard policy permissions
  -if (debug = 1)
  -log("Retrieving global policy permissions");
  -Policy policy = Policy.getPolicy();
  -policy.refresh();
  -
  -// Accumulate the common permissions we will add to all code sources
  -if (debug = 1)
  -log("Building common permissions to add");
  -ServletContext servletContext = context.getServletContext();
  -Permissions commonPerms = new Permissions();
  -URL baseURL = null;
  -try {
  -baseURL = servletContext.getResource("/");
  -if (debug = 1)
  -log(" baseURL=" + baseURL.toString());
  -} catch (MalformedURLException e) {
  -log("permissionsConfig.baseURL", e);
  -}
  -String baseFile = baseURL.toString();
  -if (baseFile.startsWith("file://")) // FIXME - file dependency
  -baseFile = baseFile.substring(7);
  -else if (baseFile.startsWith("file:"))
  -baseFile = baseFile.substring(5);
  -if (baseFile.endsWith("/"))
  -baseFile += "-";
  -else
  -baseFile += "/-";
  -commonPerms.add(new FilePermission(baseFile, "read"));
  -File workDir = (File)
  -context.getServletContext().getAttribute(Globals.WORK_DIR_ATTR);
  -try {
  -commonPerms.add(new FilePermission(workDir.getCanonicalPath() +
  -   "/-",
  -   "read,write,delete"));
  -} catch (IOException e) {
  -log("permissionsConfig.filePerm", e);
  -}
  -if (debug = 1)
  -log(" commonPerms=" + commonPerms.toString());
  -
  -// Build a CodeSource representing our document root code base
  -if (debug = 1)
  -log("Building document root code source");
  -URL docURL = null;
  -try {
  -docURL = servletContext.getResource("/WEB-INF");
  -

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java

2001-01-23 Thread glenn

glenn   01/01/23 14:05:55

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationDispatcher.java
  Log:
  Implement SecurityManager
  
  Revision  ChangesPath
  1.11  +6 -6  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java
  
  Index: ApplicationDispatcher.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ApplicationDispatcher.java2000/12/29 20:27:10 1.10
  +++ ApplicationDispatcher.java2001/01/23 22:05:52 1.11
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.10 2000/12/29 20:27:10 glenn Exp $
  - * $Revision: 1.10 $
  - * $Date: 2000/12/29 20:27:10 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.11 2001/01/23 22:05:52 glenn Exp $
  + * $Revision: 1.11 $
  + * $Date: 2001/01/23 22:05:52 $
*
* 
*
  @@ -64,10 +64,10 @@
   
   package org.apache.catalina.core;
   
  -import java.security.AccessController;
  -import java.security.PrivilegedActionException;
   import java.io.IOException;
   import java.io.PrintWriter;
  +import java.security.AccessController;
  +import java.security.PrivilegedActionException;
   import javax.servlet.RequestDispatcher;
   import javax.servlet.Servlet;
   import javax.servlet.ServletException;
  @@ -96,7 +96,7 @@
* codejavax.servlet.ServletResponseWrapper/code.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.10 $ $Date: 2000/12/29 20:27:10 $
  + * @version $Revision: 1.11 $ $Date: 2001/01/23 22:05:52 $
*/
   
   final class ApplicationDispatcher
  
  
  

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




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader Reloader.java

2001-01-23 Thread glenn

glenn   01/01/23 14:12:35

  Modified:catalina/src/share/org/apache/catalina/loader Reloader.java
  Log:
  Implement SecurityManager
  
  Revision  ChangesPath
  1.3   +4 -61 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/Reloader.java
  
  Index: Reloader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/Reloader.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Reloader.java 2000/09/21 20:06:04 1.2
  +++ Reloader.java 2001/01/23 22:12:32 1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/Reloader.java,v
 1.2 2000/09/21 20:06:04 craigmcc Exp $
  - * $Revision: 1.2 $
  - * $Date: 2000/09/21 20:06:04 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/Reloader.java,v
 1.3 2001/01/23 22:12:32 glenn Exp $
  + * $Revision: 1.3 $
  + * $Date: 2001/01/23 22:12:32 $
*
* 
*
  @@ -71,23 +71,13 @@
* codeStandardLoader/code.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.2 $ $Date: 2000/09/21 20:06:04 $
  + * @version $Revision: 1.3 $ $Date: 2001/01/23 22:12:32 $
*/
   
   public interface Reloader {
   
   
   /**
  - * Add a new fully qualified class or resource name to which access will be
  - * allowed, even if the class or resource name would otherwise match one
  - * of the restricted patterns.
  - *
  - * @param name Class or resource name to allow access for
  - */
  -public void addAllowed(String name);
  -
  -
  -/**
* Add a new repository to the set of places this ClassLoader can look for
* classes to be loaded.
*
  @@ -101,58 +91,11 @@
   
   
   /**
  - * Add a fully qualified class or resource name prefix that, if it matches
  - * the name of a requested class or resource, will cause access to that
  - * class or resource to fail (unless the complete name is on the allowed
  - * list).
  - *
  - * @param prefix The restricted prefix
  - */
  -public void addRestricted(String prefix);
  -
  -
  -/**
  - * Add a fully qualified class or resource name prefix that, if it matches
  - * the name of a requested class or resource, will cause access to that
  - * class or resource to be attempted in the system class loader only
  - * (bypassing the repositories defined in this class loader).  By default,
  - * the codejava./code prefix is defined as a system prefix.
  - *
  - * @param prefix The system prefix
  - */
  -public void addSystem(String prefix);
  -
  -
  -/**
  - * Return a String array of the allowed class or resource name list
  - * for this class loader.  If there are none, a zero-length array
  - * is returned.
  - */
  -public String[] findAllowed();
  -
  -
  -/**
* Return a String array of the current repositories for this class
* loader.  If there are no repositories, a zero-length array is
* returned.
*/
   public String[] findRepositories();
  -
  -
  -/**
  - * Return a String array of the restricted class or resource name prefixes
  - * for this class loader.  If there are none, a zero-length array
  - * is returned.
  - */
  -public String[] findRestricted();
  -
  -
  -/**
  - * Return a Striong array of the sytsem class or resource name prefixes
  - * for this class loader.  If there are none, a zero-length array
  - * is returned.
  - */
  -public String[] findSystem();
   
   
   /**
  
  
  

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




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader StandardLoader.java

2001-01-23 Thread glenn

glenn   01/01/23 14:12:51

  Modified:catalina/src/share/org/apache/catalina/loader
StandardLoader.java
  Log:
  Implement SecurityManager
  
  Revision  ChangesPath
  1.15  +15 -6 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardLoader.java
  
  Index: StandardLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardLoader.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- StandardLoader.java   2001/01/23 05:05:48 1.14
  +++ StandardLoader.java   2001/01/23 22:12:49 1.15
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardLoader.java,v
 1.14 2001/01/23 05:05:48 remm Exp $
  - * $Revision: 1.14 $
  - * $Date: 2001/01/23 05:05:48 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardLoader.java,v
 1.15 2001/01/23 22:12:49 glenn Exp $
  + * $Revision: 1.15 $
  + * $Date: 2001/01/23 22:12:49 $
*
* 
*
  @@ -110,7 +110,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
  - * @version $Revision: 1.14 $ $Date: 2001/01/23 05:05:48 $
  + * @version $Revision: 1.15 $ $Date: 2001/01/23 22:12:49 $
*/
   
   public final class StandardLoader
  @@ -602,9 +602,18 @@
   (parentClassLoader, shFactory);
for (int i = 0; i  repositories.length; i++)
classLoader.addRepository(repositories[i]);
  - classLoader.addRestricted("org.apache.catalina.");
  - classLoader.addSystem("javax.servlet.");
   ((StandardClassLoader) classLoader).setDelegate(this.delegate);
  + if (container instanceof Context) {
  + // Tell the class loader the root of the context
  + Resources resources = ((Context) container).getResources();
  + try {
  + URL contextURL = resources.getResource("/");
  + if( contextURL != null )
  + ((StandardClassLoader)classLoader).setPermissions(
  + contextURL);
  + } catch (MalformedURLException e) {
  + }
  + }
if (classLoader instanceof Lifecycle)
((Lifecycle) classLoader).start();
} catch (Throwable t) {
  
  
  

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




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader StandardClassLoader.java

2001-01-23 Thread glenn

glenn   01/01/23 14:13:09

  Modified:catalina/src/share/org/apache/catalina/loader
StandardClassLoader.java
  Log:
  Implement SecurityManager
  
  Revision  ChangesPath
  1.8   +179 -281  
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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- StandardClassLoader.java  2001/01/23 05:05:48 1.7
  +++ StandardClassLoader.java  2001/01/23 22:13:06 1.8
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardClassLoader.java,v
 1.7 2001/01/23 05:05:48 remm Exp $
  - * $Revision: 1.7 $
  - * $Date: 2001/01/23 05:05:48 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardClassLoader.java,v
 1.8 2001/01/23 22:13:06 glenn Exp $
  + * $Revision: 1.8 $
  + * $Date: 2001/01/23 22:13:06 $
*
* 
*
  @@ -65,6 +65,7 @@
   package org.apache.catalina.loader;
   
   import java.io.File;
  +import java.io.FilePermission;
   import java.io.InputStream;
   import java.io.IOException;
   import java.net.JarURLConnection;
  @@ -74,6 +75,9 @@
   import java.net.URLConnection;
   import java.net.URLStreamHandlerFactory;
   import java.net.URLStreamHandler;
  +import java.security.CodeSource;
  +import java.security.PermissionCollection;
  +import java.security.Policy;
   import java.util.ArrayList;
   import java.util.Enumeration;
   import java.util.HashMap;
  @@ -105,7 +109,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
  - * @version $Revision: 1.7 $ $Date: 2001/01/23 05:05:48 $
  + * @version $Revision: 1.8 $ $Date: 2001/01/23 22:13:06 $
*/
   
   public class StandardClassLoader
  @@ -123,6 +127,9 @@
   public StandardClassLoader() {
   
   super(new URL[0]);
  + this.parent = getParent();
  + this.system = getSystemClassLoader();
  + securityManager = System.getSecurityManager();
   
   }
   
  @@ -150,6 +157,9 @@
   public StandardClassLoader(ClassLoader parent) {
   
   super((new URL[0]), parent);
  + this.parent = parent;
  + this.system = getSystemClassLoader();
  + securityManager = System.getSecurityManager();
   
   }
   
  @@ -179,6 +189,9 @@
   public StandardClassLoader(String repositories[]) {
   
   super(convert(repositories));
  + this.parent = getParent();
  + this.system = getSystemClassLoader();
  + securityManager = System.getSecurityManager();
   if (repositories != null) {
   for (int i = 0; i  repositories.length; i++)
   addRepositoryInternal(repositories[i]);
  @@ -197,6 +210,9 @@
   public StandardClassLoader(String repositories[], ClassLoader parent) {
   
   super(convert(repositories), parent);
  + this.parent = parent;
  + this.system = getSystemClassLoader();
  + securityManager = System.getSecurityManager();
   if (repositories != null) {
   for (int i = 0; i  repositories.length; i++)
   addRepositoryInternal(repositories[i]);
  @@ -215,6 +231,9 @@
   public StandardClassLoader(URL repositories[], ClassLoader parent) {
   
   super(repositories, parent);
  + this.parent = parent;
  + this.system = getSystemClassLoader();
  + securityManager = System.getSecurityManager();
   if (repositories != null) {
   for (int i = 0; i  repositories.length; i++)
   addRepositoryInternal(repositories[i].toString());
  @@ -227,14 +246,6 @@
   
   
   /**
  - * The set of fully qualified class or resource names to which access
  - * will be allowed (if they exist) by this class loader, even if the
  - * class or resource name would normally be restricted.
  - */
  -protected String allowed[] = new String[0];
  -
  -
  -/**
* The set of optional packages (formerly standard extensions) that
* are available in the repositories associated with this class loader.
* Each object in this list is of type
  @@ -283,23 +294,32 @@
   protected ArrayList required = new ArrayList();
   
   
  +/**
  + * Instance of the SecurityManager installed.
  + */
  +private SecurityManager securityManager = null;
  +
  +
   /**
  - * The set of class name prefixes to which access should be restricted.
  - * A request for a class or resource that starts with this prefix will
  - * fail with an appropriate exception or codenull/code return value,
  - * unless that specific class or resource name is on the allowed

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationFilterChain.java

2001-01-23 Thread glenn

glenn   01/01/23 14:22:37

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationFilterChain.java
  Log:
  Implement SecurityManager
  
  Revision  ChangesPath
  1.4   +33 -4 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationFilterChain.java
  
  Index: ApplicationFilterChain.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationFilterChain.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ApplicationFilterChain.java   2000/12/17 05:18:58 1.3
  +++ ApplicationFilterChain.java   2001/01/23 22:22:35 1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationFilterChain.java,v
 1.3 2000/12/17 05:18:58 craigmcc Exp $
  - * $Revision: 1.3 $
  - * $Date: 2000/12/17 05:18:58 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationFilterChain.java,v
 1.4 2001/01/23 22:22:35 glenn Exp $
  + * $Revision: 1.4 $
  + * $Date: 2001/01/23 22:22:35 $
*
* 
*
  @@ -68,6 +68,8 @@
   import java.io.IOException;
   import java.util.ArrayList;
   import java.util.Iterator;
  +import java.security.AccessController;
  +import java.security.PrivilegedActionException;
   import javax.servlet.Filter;
   import javax.servlet.FilterChain;
   import javax.servlet.FilterConfig;
  @@ -91,7 +93,7 @@
* method itself.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.3 $ $Date: 2000/12/17 05:18:58 $
  + * @version $Revision: 1.4 $ $Date: 2001/01/23 22:22:35 $
*/
   
   final class ApplicationFilterChain implements FilterChain {
  @@ -162,6 +164,33 @@
* @exception ServletException if a servlet exception occurs
*/
   public void doFilter(ServletRequest request, ServletResponse response)
  +throws IOException, ServletException {
  +
  +if( System.getSecurityManager() != null ) {
  +final ServletRequest req = request;
  +final ServletResponse res = response;
  +try {
  +java.security.AccessController.doPrivileged(
  +new java.security.PrivilegedExceptionAction()
  +{
  +public Object run() throws ServletException, IOException {
  +internalDoFilter(req,res);
  +return null;   
  +}   
  +}  
  +); 
  +} catch( PrivilegedActionException pe) {
  +Exception e = pe.getException();
  +if( e.getClass().getName().equals("javax.servlet.ServletException") 
)
  +throw (ServletException)e; 
  +throw (IOException)e;
  +}
  +} else {
  +internalDoFilter(request,response);
  +}
  +}
  + 
  +private void internalDoFilter(ServletRequest request, ServletResponse response)
   throws IOException, ServletException {
   
   // Construct an iterator the first time this method is called
  
  
  

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




cvs commit: jakarta-tomcat-4.0/catalina/docs tomcat-security.html

2001-02-03 Thread glenn

glenn   01/02/03 08:41:10

  Added:   catalina/docs tomcat-security.html
  Log:
  Implement SecurityManager
  
  Revision  ChangesPath
  1.1  jakarta-tomcat-4.0/catalina/docs/tomcat-security.html
  
  Index: tomcat-security.html
  ===
  !doctype html public "-//w3c//dtd html 4.0 transitional//en"
  html
  head
 titleUsing the Java SecurityManager with Tomcat/title
 meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
 meta name="GENERATOR" content="Mozilla/4.7 [en] (X11; I; SunOS 5.7 i86pc) 
[Netscape]"
  /head
  body text="#00" bgcolor="#FF" link="#FF" vlink="#FF" 
alink="#88"
  
  h1
  Using the Java SecurityManager with Tomcat/h1
  
  ul
  li
  a href="#why"Why use a SecurityManager?/a/li
  
  li
  a href="#requirements"System Requirements/a/li
  
  li
  a href="#precautions"Precautions/a/li
  
  li
  a href="#permissions"Types of Permissions/a/li
  
  li
  a href="tomcat-security-unix.html"Tomcat SecurityManager setup with Unix/a/li
  
  li
  a href="#violation"What happens when the SecurityManager detects a Security
  violation?/a/li
  /ul
  
  h3
  a NAME="why"/aWhy use a SecurityManager?/h3
  The Java SecurityManager is what allows a web browser to run an applet
  in its own sandbox to prevent untrusted code from accessing files on the
  local system, connecting to a host other than the one the applet was loaded
  from, etc.
  pIn the same way the SecurityManager protects you from an untrusted applet
  running in your browser, use of a SecurityManager while running Tomcat
  can protect your server from trojan servlets, JSP's, JSP beans, and tag
  libraries.nbsp; Or even inadvertent mistakes.
  pImagine if someone who is authorized to publish JSP's on your site invadvertently
  included the following in their JSP:
  blockquote
  prelt;% System.exit(1); %/pre
  /blockquote
  
  pbrEvery time that JSP was executed by Tomcat, Tomcat would exit.
  pUsing the Java SecurityManager is just one more line of defense a system
  administrator can use to keep the server secure and reliable.
  h3
  a NAME="requirements"/aSystem Requirements/h3
  Use of the SecurityManager requires a JVM that supports JDK 1.2.
  brnbsp;
  h3
  a NAME="precautions"/aPrecautions/h3
  Implementation of a SecurityManager in Tomcat has not been fully tested
  or had a security audit.  Make sure that you are satisfied with
  your SecurityManager configuration before allowing untrusted users to publish
  web applications, JSP's, servlets, beans, or tag libraries.
  pStill, running with a SecurityManager is definitely better than running
  without one.
  brnbsp;
  h3
  a NAME="permissions"/aTypes of Permissions/h3
  Permission classes are used to define what Permissions a class loaded by
  Tomcat will have.nbsp; There are a number of Permission classes as part
  of the JDK and you can even create your own Permission class for use in
  your own web applications.
  pThis is just a short summary of the System SecurityManager Permission
  classes applicable to Tomcat.nbsp; Please refer to the JDK documentation
  for more information on using the below Permissions.
  pbjava.util.PropertyPermission/b
  brnbsp;nbsp;nbsp; Controls read/write access to JVM properties such
  as java.home.
  pbjava.lang.RuntimePermission/b
  brnbsp;nbsp;nbsp; Controls use of some System/Runtime functions like
  exit() and exec().
  pbjava.io.FilePermission/b
  brnbsp;nbsp;nbsp; Controls read/write/execute access to files and
  directories.
  pbjava.net.SocketPermission/b
  brnbsp;nbsp;nbsp; Controls use of network sockets.
  pbjava.net.NetPermission/b
  brnbsp;nbsp;nbsp; Controls use of multicast network connections.
  pbjava.lang.reflect.ReflectPermission/b
  brnbsp;nbsp;nbsp; Controls use of reflection to do class introspection.
  pbjava.security.SecurityPermission/b
  brnbsp;nbsp;nbsp; Controls access to Security methods.
  pbjava.security.AllPermission/b
  brnbsp;nbsp;nbsp; Allows access to all permissions, just as if you
  were running Tomcat without a SecurityManager.
  brnbsp;
  h3
  a NAME="violation"/aWhat happens when the SecurityManager detects a
  Security violation?/h3
  The JVM will throw an AccessControlException or a SecurityException when
  the SecurityManager detects a security policy violation.
  brnbsp;
  /body
  /html
  
  
  

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




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector HttpRequestBase.java

2001-02-03 Thread glenn

glenn   01/02/03 16:47:59

  Modified:catalina/src/share/org/apache/catalina/connector
HttpRequestBase.java
  Log:
  Implement SecurityManager
  
  Revision  ChangesPath
  1.16  +7 -5  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/HttpRequestBase.java
  
  Index: HttpRequestBase.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/HttpRequestBase.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- HttpRequestBase.java  2001/01/30 04:14:49 1.15
  +++ HttpRequestBase.java  2001/02/04 00:47:59 1.16
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/HttpRequestBase.java,v
 1.15 2001/01/30 04:14:49 remm Exp $
  - * $Revision: 1.15 $
  - * $Date: 2001/01/30 04:14:49 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/HttpRequestBase.java,v
 1.16 2001/02/04 00:47:59 glenn Exp $
  + * $Revision: 1.16 $
  + * $Date: 2001/02/04 00:47:59 $
*
* 
*
  @@ -66,7 +66,9 @@
   
   
   import java.io.IOException;
  +import java.security.AccessController;
   import java.security.Principal;
  +import java.security.PrivilegedAction;
   import java.text.ParseException;
   import java.text.SimpleDateFormat;
   import java.util.ArrayList;
  @@ -98,7 +100,7 @@
* be implemented.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.15 $ $Date: 2001/01/30 04:14:49 $
  + * @version $Revision: 1.16 $ $Date: 2001/02/04 00:47:59 $
*/
   
   public class HttpRequestBase
  @@ -1014,7 +1016,6 @@
* @param create Create a new session if one does not exist
*/
   public HttpSession getSession(boolean create) {
  -
   // There cannot be a session if no context has been assigned yet
   if (context == null)
   return (null);
  @@ -1024,6 +1025,7 @@
session = null;
if (session != null)
return (session.getSession());
  +
   
// Return the requested session if it exists and is valid
Manager manager = null;
  
  
  

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




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector HttpResponseBase.java

2001-02-03 Thread glenn

glenn   01/02/03 16:48:21

  Modified:catalina/src/share/org/apache/catalina/connector
HttpResponseBase.java
  Log:
  Implement SecurityManager
  
  Revision  ChangesPath
  1.27  +21 -20
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/HttpResponseBase.java
  
  Index: HttpResponseBase.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/HttpResponseBase.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- HttpResponseBase.java 2001/02/03 07:48:31 1.26
  +++ HttpResponseBase.java 2001/02/04 00:48:21 1.27
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/HttpResponseBase.java,v
 1.26 2001/02/03 07:48:31 remm Exp $
  - * $Revision: 1.26 $
  - * $Date: 2001/02/03 07:48:31 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/HttpResponseBase.java,v
 1.27 2001/02/04 00:48:21 glenn Exp $
  + * $Revision: 1.27 $
  + * $Date: 2001/02/04 00:48:21 $
*
* 
*
  @@ -70,6 +70,8 @@
   import java.io.PrintWriter;
   import java.net.MalformedURLException;
   import java.net.URL;
  +import java.security.AccessController;
  +import java.security.PrivilegedAction;
   import java.text.SimpleDateFormat;
   import java.util.ArrayList;
   import java.util.Date;
  @@ -97,7 +99,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
  - * @version $Revision: 1.26 $ $Date: 2001/02/03 07:48:31 $
  + * @version $Revision: 1.27 $ $Date: 2001/02/04 00:48:21 $
*/
   
   public class HttpResponseBase
  @@ -528,7 +530,7 @@
// Prepare a suitable output writer
OutputStreamWriter osr =
new OutputStreamWriter(getStream(), getCharacterEncoding());
  - PrintWriter outputWriter = new PrintWriter(osr);
  + final PrintWriter outputWriter = new PrintWriter(osr);
   
// Send the "Status:" header
outputWriter.print(request.getRequest().getProtocol());
  @@ -546,28 +548,28 @@
// Send the content-length and content-type headers (if any)
if (getContentType() != null) {
outputWriter.print("Content-Type: " + getContentType() + "\r\n");
  -//System.out.println(" Content-Type: " + getContentType());
  +// System.out.println(" Content-Type: " + getContentType());
}
if (getContentLength() = 0) {
outputWriter.print("Content-Length: " + getContentLength() +
   "\r\n");
  -//System.out.println(" Content-Length: " + 
getContentLength());
  +// System.out.println(" Content-Length: " + getContentLength());
}
   
// Send all specified headers (if any)
synchronized (headers) {
  - Iterator names = headers.keySet().iterator();
  - while (names.hasNext()) {
  - String name = (String) names.next();
  - ArrayList values = (ArrayList) headers.get(name);
  - Iterator items = values.iterator();
  - while (items.hasNext()) {
  - String value = (String) items.next();
  + Iterator names = headers.keySet().iterator();
  + while (names.hasNext()) {
  + String name = (String) names.next();
  + ArrayList values = (ArrayList) headers.get(name);
  + Iterator items = values.iterator();
  + while (items.hasNext()) {
  + String value = (String) items.next();
outputWriter.print(name);
outputWriter.print(": ");
outputWriter.print(value);
outputWriter.print("\r\n");
  -//System.out.println(" " + name + ": " + 
value);
  +// System.out.println(" " + name + ": " + value);
}
}
}
  @@ -602,10 +604,10 @@
outputWriter.print(": ");
outputWriter.print(CookieTools.getCookieHeaderValue(cookie));
outputWriter.print("\r\n");
  -//System.out.println(" " +
  -//   
CookieTools.getCookieHeaderName(cookie) +
  -//   ": " +
  -//   
CookieTools.getCookieHeaderValue(cookie));
  +// System.out.println(" " +
  +// CookieTools.getCookieHeaderName(cookie) +
  +// ": "

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http HttpRequestImpl.java

2001-02-03 Thread glenn

glenn   01/02/03 16:49:02

  Modified:catalina/src/share/org/apache/catalina/connector/http
HttpRequestImpl.java
  Log:
  Implement SecurityManager
  
  Revision  ChangesPath
  1.6   +16 -21
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpRequestImpl.java
  
  Index: HttpRequestImpl.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpRequestImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- HttpRequestImpl.java  2000/12/03 00:47:49 1.5
  +++ HttpRequestImpl.java  2001/02/04 00:49:02 1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpRequestImpl.java,v
 1.5 2000/12/03 00:47:49 remm Exp $
  - * $Revision: 1.5 $
  - * $Date: 2000/12/03 00:47:49 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpRequestImpl.java,v
 1.6 2001/02/04 00:49:02 glenn Exp $
  + * $Revision: 1.6 $
  + * $Date: 2001/02/04 00:49:02 $
*
* 
*
  @@ -67,6 +67,8 @@
   
   import java.io.IOException;
   import java.net.InetAddress;
  +import java.security.AccessController;
  +import java.security.PrivilegedAction;
   import java.util.ArrayList;
   import java.util.Enumeration;
   import javax.servlet.ServletInputStream;
  @@ -79,7 +81,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
  - * @version $Revision: 1.5 $ $Date: 2000/12/03 00:47:49 $
  + * @version $Revision: 1.6 $ $Date: 2001/02/04 00:49:02 $
*/
   
   final class HttpRequestImpl
  @@ -372,15 +374,13 @@
* @param name Name of the requested header
*/
   public Enumeration getHeaders(String name) {
  -
  -ArrayList tempArrayList = new ArrayList();
  - name = name.toLowerCase();
  -for (int i = 0; i  nextHeader; i++) {
  -if (headerPool[i].equals(name))
  -tempArrayList.add(new String(headerPool[i].value, 0,
  + ArrayList tempArrayList = new ArrayList();
  + for (int i = 0; i  nextHeader; i++) {
  + if (headerPool[i].equals(name))
  + tempArrayList.add(new String(headerPool[i].value, 0,
headerPool[i].valueEnd));
   }
  -return new Enumerator(tempArrayList);
  +return (Enumeration) new Enumerator(tempArrayList);
   
   }
   
  @@ -389,18 +389,13 @@
* Return the names of all headers received with this request.
*/
   public Enumeration getHeaderNames() {
  -
  -ArrayList tempArrayList = new ArrayList();
  -for (int i = 0; i  nextHeader; i++) {
  -tempArrayList.add(new String(headerPool[i].name, 0,
  + ArrayList tempArrayList = new ArrayList();
  + for (int i = 0; i  nextHeader; i++) {
  + tempArrayList.add(new String(headerPool[i].name, 0,
headerPool[i].nameEnd));
  -}
  -return new Enumerator(tempArrayList);
  + }
  + return (Enumeration) new Enumerator(tempArrayList);
   
   }
  -
  -
  -
  -
   
   }
  
  
  

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




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java

2001-02-03 Thread glenn

glenn   01/02/03 16:49:41

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationContext.java
  Log:
  Implement SecurityManager
  
  Revision  ChangesPath
  1.14  +92 -25
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java
  
  Index: ApplicationContext.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ApplicationContext.java   2001/01/25 19:09:15 1.13
  +++ ApplicationContext.java   2001/02/04 00:49:41 1.14
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v
 1.13 2001/01/25 19:09:15 remm Exp $
  - * $Revision: 1.13 $
  - * $Date: 2001/01/25 19:09:15 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v
 1.14 2001/02/04 00:49:41 glenn Exp $
  + * $Revision: 1.14 $
  + * $Date: 2001/02/04 00:49:41 $
*
* 
*
  @@ -69,6 +69,10 @@
   import java.io.File;
   import java.net.MalformedURLException;
   import java.net.URL;
  +import java.security.AccessController;
  +import java.security.PrivilegedAction;
  +import java.security.PrivilegedExceptionAction;
  +import java.security.PrivilegedActionException;
   import java.util.ArrayList;
   import java.util.Arrays;
   import java.util.Enumeration;
  @@ -107,12 +111,60 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
  - * @version $Revision: 1.13 $ $Date: 2001/01/25 19:09:15 $
  + * @version $Revision: 1.14 $ $Date: 2001/02/04 00:49:41 $
*/
   
   public final class ApplicationContext
   implements ServletContext {
   
  +protected class PrivilegedGetRequestDispatcher implements PrivilegedAction {
  +private String contextPath;
  +private String relativeURI;
  +private String queryString;   
  +
  +PrivilegedGetRequestDispatcher(String contextPath, String relativeURI,
  + String queryString)
  +{
  +this.contextPath = contextPath;
  +this.relativeURI = relativeURI;
  +this.queryString = queryString;
  +} 
  +  
  +public Object run() {
  + HttpRequestBase request = new HttpRequestBase();
  +request.setContext(context);   
  +request.setContextPath(context.getPath());
  +request.setRequestURI(contextPath + relativeURI);
  +request.setQueryString(queryString);
  +Wrapper wrapper = (Wrapper) context.map(request, true);
  +if (wrapper == null)   
  +return (null);  
  +
  +// Construct a RequestDispatcher to process this request
  +HttpServletRequest hrequest = (HttpServletRequest) request.getRequest();
  +return (RequestDispatcher) new ApplicationDispatcher(wrapper,
  +hrequest.getServletPath(), 
  +hrequest.getPathInfo(),   
  +hrequest.getQueryString(),
  +null);
  +}
  +}
  +
  +protected class PrivilegedGetResource implements PrivilegedExceptionAction {
  + private String path;
  + private DirContext resources;
  +
  +PrivilegedGetResource(String path, DirContext resources)
  +{
  +this.path = path;
  +this.resources = resources;
  +}
  + 
  +public Object run() throws Exception {
  +return new URL("jndi", null, 0, path,
  +   new DirContextURLStreamHandler(resources));
  +}
  +}
   
   // --- Constructors
   
  @@ -128,7 +180,6 @@
super();
this.context = context;
   this.basePath = basePath;
  -
   }
   
   
  @@ -397,25 +448,31 @@
   relativeURI = path.substring(0, question);
   queryString = path.substring(question + 1);
   }
  -HttpRequestBase request = new HttpRequestBase();
  -request.setContext(context);
  -request.setContextPath(context.getPath());
  -request.setRequestURI(contextPath + relativeURI);
  -request.setQueryString(queryString);
  -Wrapper wrapper = (Wrapper) context.map(request, true);
  -if (wrapper == null)
  -return (null);
  + if( System.getSecurityManager() != null ) {
  + PrivilegedGetRequestDispatcher dp =
  +  

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationDispatcher.java

2001-02-03 Thread glenn

glenn   01/02/03 16:49:57

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationDispatcher.java
  Log:
  Implement SecurityManager
  
  Revision  ChangesPath
  1.12  +42 -26
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java
  
  Index: ApplicationDispatcher.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ApplicationDispatcher.java2001/01/23 22:05:52 1.11
  +++ ApplicationDispatcher.java2001/02/04 00:49:56 1.12
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.11 2001/01/23 22:05:52 glenn Exp $
  - * $Revision: 1.11 $
  - * $Date: 2001/01/23 22:05:52 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
 1.12 2001/02/04 00:49:56 glenn Exp $
  + * $Revision: 1.12 $
  + * $Date: 2001/02/04 00:49:56 $
*
* 
*
  @@ -67,6 +67,7 @@
   import java.io.IOException;
   import java.io.PrintWriter;
   import java.security.AccessController;
  +import java.security.PrivilegedExceptionAction;
   import java.security.PrivilegedActionException;
   import javax.servlet.RequestDispatcher;
   import javax.servlet.Servlet;
  @@ -96,13 +97,45 @@
* codejavax.servlet.ServletResponseWrapper/code.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.11 $ $Date: 2001/01/23 22:05:52 $
  + * @version $Revision: 1.12 $ $Date: 2001/02/04 00:49:56 $
*/
   
   final class ApplicationDispatcher
   implements RequestDispatcher {
   
   
  +protected class PrivilegedForward implements PrivilegedExceptionAction {
  +private ServletRequest request;
  +private ServletResponse response;
  +
  +PrivilegedForward(ServletRequest request, ServletResponse response)
  +{   
  + this.request = request;
  + this.response = response;
  +}   
  +
  +public Object run() throws ServletException, IOException {
  + doForward(request,response);
  + return null;
  +}   
  +}
  +
  +protected class PrivilegedInclude implements PrivilegedExceptionAction {
  +private ServletRequest request;
  +private ServletResponse response;
  +
  +PrivilegedInclude(ServletRequest request, ServletResponse response)
  +{  
  +this.request = request;
  +this.response = response;
  +}
  +
  +public Object run() throws ServletException, IOException {
  +doInclude(request,response);
  +return null;
  +}  
  +}
  +
   // --- Constructors
   
   
  @@ -214,18 +247,9 @@
   throws ServletException, IOException
   {
   if( System.getSecurityManager() != null ) {
  -final ServletRequest req = request;
  -final ServletResponse res = response;
   try {
  -java.security.AccessController.doPrivileged(
  -new java.security.PrivilegedExceptionAction()
  -{
  -public Object run() throws ServletException, IOException {
  -doForward(req,res);
  -return null;
  -}
  -}
  -);
  + PrivilegedForward dp = new PrivilegedForward(request,response);
  +AccessController.doPrivileged(dp);
   } catch( PrivilegedActionException pe) {
   Exception e = pe.getException();
   if( e.getClass().getName().equals("javax.servlet.ServletException") 
)
  @@ -366,20 +390,12 @@
   throws ServletException, IOException
   {
   if( System.getSecurityManager() != null ) {
  -final ServletRequest req = request;
  -final ServletResponse res = response;
   try {
  -java.security.AccessController.doPrivileged(
  -new java.security.PrivilegedExceptionAction()
  -{
  -public Object run() throws ServletException, IOException {
  -doInclude(req,res);
  -return null;   
  -}   
  -}   
  -);  
  +PrivilegedInclude dp = new PrivilegedInclude(request,response);
  +AccessController.doPrivileged(dp);

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationFilterChain.java

2001-02-03 Thread glenn

glenn   01/02/03 16:50:09

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationFilterChain.java
  Log:
  Implement SecurityManager
  
  Revision  ChangesPath
  1.5   +7 -5  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationFilterChain.java
  
  Index: ApplicationFilterChain.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationFilterChain.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ApplicationFilterChain.java   2001/01/23 22:22:35 1.4
  +++ ApplicationFilterChain.java   2001/02/04 00:50:09 1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationFilterChain.java,v
 1.4 2001/01/23 22:22:35 glenn Exp $
  - * $Revision: 1.4 $
  - * $Date: 2001/01/23 22:22:35 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationFilterChain.java,v
 1.5 2001/02/04 00:50:09 glenn Exp $
  + * $Revision: 1.5 $
  + * $Date: 2001/02/04 00:50:09 $
*
* 
*
  @@ -93,7 +93,7 @@
* method itself.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.4 $ $Date: 2001/01/23 22:22:35 $
  + * @version $Revision: 1.5 $ $Date: 2001/02/04 00:50:09 $
*/
   
   final class ApplicationFilterChain implements FilterChain {
  @@ -183,7 +183,9 @@
   Exception e = pe.getException();
   if( e.getClass().getName().equals("javax.servlet.ServletException") 
)
   throw (ServletException)e; 
  -throw (IOException)e;
  + if( e.getClass().getName().equals("java.io.IOException") )
  +throw (IOException)e;
  + throw new ServletException(e.getMessage());
   }
   } else {
   internalDoFilter(request,response);
  
  
  

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




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader StandardClassLoader.java

2001-02-03 Thread glenn

glenn   01/02/03 16:50:40

  Modified:catalina/src/share/org/apache/catalina/loader
StandardClassLoader.java
  Log:
  Implement SecurityManager
  
  Revision  ChangesPath
  1.9   +19 -8 
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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- StandardClassLoader.java  2001/01/23 22:13:06 1.8
  +++ StandardClassLoader.java  2001/02/04 00:50:40 1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardClassLoader.java,v
 1.8 2001/01/23 22:13:06 glenn Exp $
  - * $Revision: 1.8 $
  - * $Date: 2001/01/23 22:13:06 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardClassLoader.java,v
 1.9 2001/02/04 00:50:40 glenn Exp $
  + * $Revision: 1.9 $
  + * $Date: 2001/02/04 00:50:40 $
*
* 
*
  @@ -109,7 +109,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
  - * @version $Revision: 1.8 $ $Date: 2001/01/23 22:13:06 $
  + * @version $Revision: 1.9 $ $Date: 2001/02/04 00:50:40 $
*/
   
   public class StandardClassLoader
  @@ -621,10 +621,8 @@
   if (i = 0) {
   try {
   securityManager.checkPackageDefinition(name.substring(0,i));
  -} catch (SecurityException se) {
  -String error = "Security Violation, attempt to define " +
  -"a Class in a restricted package: " + name;
  -throw new ClassNotFoundException(error);
  +} catch (Exception se) {
  + throw new ClassNotFoundException(name);
   }
   }
   }
  @@ -927,6 +925,18 @@
   return (clazz);
   }
   
  + // If a system class, use system class loader
  + if( name.startsWith("java.") ) {
  +ClassLoader loader = system;
  +clazz = loader.loadClass(name);
  +if (clazz != null) { 
  +if (resolve) 
  +resolveClass(clazz);
  +return (clazz);
  +}
  + throw new ClassNotFoundException(name);
  + }
  +
   // (.5) Permission to access this class when using a SecurityManager
   if (securityManager != null) {
   int i = name.lastIndexOf('.');
  @@ -937,6 +947,7 @@
   String error = "Security Violation, attempt to use " +
   "Restricted Class: " + name;
System.out.println(error);
  + se.printStackTrace();
   log(error);
   throw new ClassNotFoundException(error);
   }
  
  
  

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




cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper EmbededServletOptions.java

2001-02-03 Thread glenn

glenn   01/02/03 17:03:29

  Modified:jasper/src/share/org/apache/jasper
EmbededServletOptions.java
  Log:
  - Implemented Java SecurityManager
  - Switched to using URLClassLoader
  
  Jasper now creates a URLClassLoader for each JSP page and defers any other
  class loading to the web app context class loader.  Using a single class
  loader per JSP allowed me to remove all the code that increments the
  class version number, i.e. the work directory no longer has multiple
  *.java and *.class files for the same JSP page.  These changes also made
  it easy for me to put the java source and class files in the same directory
  tree as found in the web app context.  When Jasper is run in a servlet
  container it no longer puts the class files in a package, they are now
  in the default package.
  
  Revision  ChangesPath
  1.6   +3 -17 
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/EmbededServletOptions.java
  
  Index: EmbededServletOptions.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/EmbededServletOptions.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EmbededServletOptions.java2000/12/22 01:27:37 1.5
  +++ EmbededServletOptions.java2001/02/04 01:03:28 1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/EmbededServletOptions.java,v
 1.5 2000/12/22 01:27:37 pierred Exp $
  - * $Revision: 1.5 $
  - * $Date: 2000/12/22 01:27:37 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/EmbededServletOptions.java,v
 1.6 2001/02/04 01:03:28 glenn Exp $
  + * $Revision: 1.6 $
  + * $Date: 2001/02/04 01:03:28 $
*
* 
* 
  @@ -110,11 +110,6 @@
* in?
*/
   public File scratchDir;
  -/**
  - * When used with a Securitymanager, what ProtectionDomain to use.
  - */
  -private Object protectionDomain;
  -
   
   /**
* Need to have this as is for versions 4 and 5 of IE. Can be set from
  @@ -192,12 +187,6 @@
   }
   
   /**
  - * ProtectionDomain for this JSP Context when using a SecurityManager
  - */
  -public final Object getProtectionDomain() {
  -return protectionDomain;
  -}
  -/**
* What classpath should I use while compiling the servlets
* generated from JSP files?
*/
  @@ -294,9 +283,6 @@
   }
   }
   
  -// Get the ProtectionDomain for this Context in case
  -// we are using a SecurityManager
  -protectionDomain = 
context.getAttribute(Constants.ATTRIB_JSP_ProtectionDomain);
   if (this.scratchDir == null) {
   Constants.message("jsp.error.no.scratch.dir", Logger.FATAL);
   return;
  
  
  

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




cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper JspC.java

2001-02-03 Thread glenn

glenn   01/02/03 17:03:43

  Modified:jasper/src/share/org/apache/jasper JspC.java
  Log:
  - Implemented Java SecurityManager
  - Switched to using URLClassLoader
  
  Jasper now creates a URLClassLoader for each JSP page and defers any other
  class loading to the web app context class loader.  Using a single class
  loader per JSP allowed me to remove all the code that increments the
  class version number, i.e. the work directory no longer has multiple
  *.java and *.class files for the same JSP page.  These changes also made
  it easy for me to put the java source and class files in the same directory
  tree as found in the web app context.  When Jasper is run in a servlet
  container it no longer puts the class files in a package, they are now
  in the default package.
  
  Revision  ChangesPath
  1.8   +14 -18jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspC.java
  
  Index: JspC.java
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspC.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JspC.java 2000/12/22 01:27:37 1.7
  +++ JspC.java 2001/02/04 01:03:42 1.8
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspC.java,v 1.7 
2000/12/22 01:27:37 pierred Exp $
  - * $Revision: 1.7 $
  - * $Date: 2000/12/22 01:27:37 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspC.java,v 1.8 
2001/02/04 01:03:42 glenn Exp $
  + * $Revision: 1.8 $
  + * $Date: 2001/02/04 01:03:42 $
*
* 
* 
  @@ -62,6 +62,7 @@
   package org.apache.jasper;
   
   import java.io.*;
  +import java.net.*;
   import java.util.*;
   
   import org.apache.jasper.compiler.JspReader;
  @@ -71,7 +72,6 @@
   import org.apache.jasper.compiler.CommandLineCompiler;
   import org.apache.jasper.compiler.TldLocationsCache;
   
  -//import org.apache.jasper.runtime.JspLoader;
   import org.apache.jasper.servlet.JasperLoader;
   
   import org.apache.jasper.logging.Logger;
  @@ -145,8 +145,6 @@
   static int die; // I realize it is duplication, but this is for
   // the static main catch
   
  -//JspLoader loader;
  -
   boolean dirset;
   
   Vector extensions;
  @@ -194,10 +192,6 @@
   return scratchDir;
   }
   
  -//public String getClassPath() {
  -//return classpath;
  -//}
  -
   public Class getJspCompilerPlugin() {
  // we don't compile, so this is meanlingless
   return null;
  @@ -339,28 +333,25 @@
   public boolean parseFile(PrintStream log, String file, Writer servletout, 
Writer mappingout)
   {
   try {
  -JasperLoader loader = new JasperLoader();
  - loader.setParentClassLoader(getClass().getClassLoader());
  - loader.setOptions( this);
   CommandLineContext clctxt = new CommandLineContext(
  -loader, getClassPath(), file, uriBase, uriRoot, false,
  +getClassPath(), file, uriBase, uriRoot, false,
   this);
   if ((targetClassName != null)  (targetClassName.length()  0)) {
   clctxt.setServletClassName(targetClassName);
  -clctxt.lockClassName();
   }
   if (targetPackage != null) {
   clctxt.setServletPackageName(targetPackage);
  -clctxt.lockPackageName();
   }
   if (dirset) {
   clctxt.setOutputInDirs(true);
   }
  + ArrayList urls = new ArrayList();
  +
   if (new File(clctxt.getRealPath("/")).exists()) {
   File classes = new File(clctxt.getRealPath("/WEB-INF/classes"));
   try {
if (classes.exists()) {
  -loader.addJar(classes.getCanonicalPath());
  + urls.add(classes.toURL());
   }
   } catch (IOException ioe) {
   // failing a toCanonicalPath on a file that
  @@ -373,9 +364,10 @@
   String[] libs = lib.list();
   for (int i = 0; i  libs.length; i++) {
   try {
  -loader.addJar(lib.getCanonicalPath()
  + File libFile = new File(lib.toString()
   + File.separator
   + libs[i]);
  + urls.add(libFile.toURL());
   } catch (IOException ioe) {
   // failing a toCanonicalPath on a file that
   // exists() should be a JVM regression test

cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper JspCompilationContext.java

2001-02-03 Thread glenn

glenn   01/02/03 17:03:53

  Modified:jasper/src/share/org/apache/jasper
JspCompilationContext.java
  Log:
  - Implemented Java SecurityManager
  - Switched to using URLClassLoader
  
  Jasper now creates a URLClassLoader for each JSP page and defers any other
  class loading to the web app context class loader.  Using a single class
  loader per JSP allowed me to remove all the code that increments the
  class version number, i.e. the work directory no longer has multiple
  *.java and *.class files for the same JSP page.  These changes also made
  it easy for me to put the java source and class files in the same directory
  tree as found in the web app context.  When Jasper is run in a servlet
  container it no longer puts the class files in a package, they are now
  in the default package.
  
  Revision  ChangesPath
  1.4   +5 -19 
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspCompilationContext.java
  
  Index: JspCompilationContext.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspCompilationContext.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JspCompilationContext.java2000/11/06 20:52:19 1.3
  +++ JspCompilationContext.java2001/02/04 01:03:52 1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspCompilationContext.java,v
 1.3 2000/11/06 20:52:19 pierred Exp $
  - * $Revision: 1.3 $
  - * $Date: 2000/11/06 20:52:19 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspCompilationContext.java,v
 1.4 2001/02/04 01:03:52 glenn Exp $
  + * $Revision: 1.4 $
  + * $Date: 2001/02/04 01:03:52 $
*
* 
* 
  @@ -67,7 +67,6 @@
   
   import org.apache.jasper.compiler.JspReader;
   import org.apache.jasper.compiler.ServletWriter;
  -//import org.apache.jasper.runtime.JspLoader;
   import org.apache.jasper.compiler.TagLibraries;
   import java.io.IOException;
   import java.net.URL;
  @@ -79,9 +78,6 @@
* engine. This is a per-request/per-context data structure. Some of
* the instance variables are set at different points.
*
  - * JspLoader creates this object and passes this off to the "compiler"
  - * subsystem, which then initializes the rest of the variables. 
  - *
* @author Anil K. Vijendran
* @author Harish Prabandham
* @author Pierre Delisle
  @@ -109,10 +105,6 @@
*/
   public ClassLoader getClassLoader();
   
  -/** Add a jar to the classpath used by the loader
  - */
  -void addJar(String jar) throws IOException ;
  -
   /**
* Are we processing something that has been declared as an
* errorpage? 
  @@ -139,17 +131,11 @@
   public String getServletClassName();
   
   /**
  - * The package name into which the servlet class is generated. 
  + * The package name into which the servlet class is generated.
*/
   public String getServletPackageName();
   
   /**
  - * Utility method to get the full class name from the package and
  - * class name. 
  - */
  -public String getFullClassName();
  -
  -/**
* Full path name of the Java file into which the servlet is being
* generated. 
*/
  @@ -180,7 +166,7 @@
   void setServletClassName(String servletClassName);
   
   public void setServletPackageName(String servletPackageName);
  -
  +
   public void setServletJavaFileName(String servletJavaFileName);
   
   public void setErrorPage(boolean isErrPage);
  
  
  

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




cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper JspEngineContext.java

2001-02-03 Thread glenn

glenn   01/02/03 17:04:03

  Modified:jasper/src/share/org/apache/jasper JspEngineContext.java
  Log:
  - Implemented Java SecurityManager
  - Switched to using URLClassLoader
  
  Jasper now creates a URLClassLoader for each JSP page and defers any other
  class loading to the web app context class loader.  Using a single class
  loader per JSP allowed me to remove all the code that increments the
  class version number, i.e. the work directory no longer has multiple
  *.java and *.class files for the same JSP page.  These changes also made
  it easy for me to put the java source and class files in the same directory
  tree as found in the web app context.  When Jasper is run in a servlet
  container it no longer puts the class files in a package, they are now
  in the default package.
  
  Revision  ChangesPath
  1.4   +25 -31
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspEngineContext.java
  
  Index: JspEngineContext.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspEngineContext.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JspEngineContext.java 2000/11/06 20:52:20 1.3
  +++ JspEngineContext.java 2001/02/04 01:04:02 1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspEngineContext.java,v
 1.3 2000/11/06 20:52:20 pierred Exp $
  - * $Revision: 1.3 $
  - * $Date: 2000/11/06 20:52:20 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspEngineContext.java,v
 1.4 2001/02/04 01:04:02 glenn Exp $
  + * $Revision: 1.4 $
  + * $Date: 2001/02/04 01:04:02 $
*
* 
* 
  @@ -65,16 +65,17 @@
   
   package org.apache.jasper;
   
  +import java.io.IOException;
  +import java.io.File;
   import java.net.URL;
  +import java.net.URLClassLoader;
   import java.net.MalformedURLException;
   import javax.servlet.ServletContext;
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
  -import java.io.IOException;
   
   import org.apache.jasper.compiler.JspReader;
   import org.apache.jasper.compiler.ServletWriter;
  -//import org.apache.jasper.runtime.JspLoader;
   import org.apache.jasper.servlet.JasperLoader;
   import org.apache.jasper.compiler.TagLibraries;
   
  @@ -89,9 +90,6 @@
* engine. This is a per-request/per-context data structure. Some of
* the instance variables are set at different points.
*
  - * JspLoader creates this object and passes this off to the "compiler"
  - * subsystem, which then initializes the rest of the variables. 
  - *
* @author Anil K. Vijendran
* @author Harish Prabandham
* @author Pierre Delisle
  @@ -100,10 +98,11 @@
   JspReader reader;
   ServletWriter writer;
   ServletContext context;
  -JasperLoader loader;
  +URLClassLoader loader;
   String classpath; // for compiling JSPs.
   boolean isErrPage;
   String jspFile;
  +String outDir;
   String servletClassName;
   String servletPackageName;
   String servletJavaFileName;
  @@ -113,15 +112,16 @@
   HttpServletResponse res;
   
   
  -public JspEngineContext(JasperLoader loader, String classpath, 
  -ServletContext context, String jspFile, 
  -boolean isErrPage, Options options, 
  +public JspEngineContext(URLClassLoader loader, String classpath, 
  +ServletContext context, String jspFile, String outDir,
  +boolean isErrPage, Options options,
   HttpServletRequest req, HttpServletResponse res) 
   {
   this.loader = loader;
   this.classpath = classpath;
   this.context = context;
   this.jspFile = jspFile;
  + this.outDir = outDir;
   this.isErrPage = isErrPage;
   this.options = options;
   this.req = req;
  @@ -147,7 +147,15 @@
* The classpath that is passed off to the Java compiler. 
*/
   public String getClassPath() {
  -return loader.getClassPath() + classpath;
  + URL [] urls = loader.getURLs();
  +StringBuffer cpath = new StringBuffer();
  +String sep = System.getProperty("path.separator");
  +
  +for(int i = 0; i  urls.length; i++) {
  +cpath.append((String)urls[i].getFile()+sep);
  +}
  + 
  +return cpath.toString() + classpath;
   }
   
   /**
  @@ -179,10 +187,6 @@
   return loader;
   }
   
  -public void addJar( String jar ) throws IOException  {
  - loader.addJar( jar );
  -}
  -
   /**
* Are we processing something that has been declared as an
* errorpage?

cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler CommandLineCompiler.java

2001-02-03 Thread glenn

glenn   01/02/03 17:04:36

  Modified:jasper/src/share/org/apache/jasper/compiler
CommandLineCompiler.java
  Log:
  - Implemented Java SecurityManager
  - Switched to using URLClassLoader
  
  Jasper now creates a URLClassLoader for each JSP page and defers any other
  class loading to the web app context class loader.  Using a single class
  loader per JSP allowed me to remove all the code that increments the
  class version number, i.e. the work directory no longer has multiple
  *.java and *.class files for the same JSP page.  These changes also made
  it easy for me to put the java source and class files in the same directory
  tree as found in the web app context.  When Jasper is run in a servlet
  container it no longer puts the class files in a package, they are now
  in the default package.
  
  Revision  ChangesPath
  1.2   +14 -87
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/CommandLineCompiler.java
  
  Index: CommandLineCompiler.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/CommandLineCompiler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CommandLineCompiler.java  2000/08/12 00:52:07 1.1
  +++ CommandLineCompiler.java  2001/02/04 01:04:35 1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/CommandLineCompiler.java,v
 1.1 2000/08/12 00:52:07 pierred Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/08/12 00:52:07 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/CommandLineCompiler.java,v
 1.2 2001/02/04 01:04:35 glenn Exp $
  + * $Revision: 1.2 $
  + * $Date: 2001/02/04 01:04:35 $
*
* The Apache Software License, Version 1.1
*
  @@ -74,6 +74,7 @@
   
   String javaFileName;
   String classFileName;
  +String packageName;
   String pkgName;
   String className;
   File jsp;
  @@ -84,18 +85,15 @@
   
   jsp = new File(ctxt.getJspFile());
   outputDir =  ctxt.getOptions().getScratchDir().getAbsolutePath();
  -
  + packageName = ctxt.getServletPackageName();
  + if( packageName == null )
  + packageName = "";
  + pkgName = packageName;
   setMangler(this);
   
  -computePackageName();
  -ctxt.setServletPackageName(pkgName);
   className = getBaseClassName();
   // yes this is kind of messed up ... but it works
   if (ctxt.isOutputInDirs()) {
  -String pkgName = ctxt.getServletPackageName();
  -if (pkgName == null) {
  -pkgName = "";
  -}
   String tmpDir = outputDir
  + File.separatorChar
  + pkgName.replace('.', File.separatorChar);
  @@ -132,8 +130,7 @@
   }
   
   void computeClassFileName() {
  -String prefix = getPrefix(jsp.getPath());
  -classFileName = prefix + getBaseClassName() + ".class";
  +classFileName = getBaseClassName() + ".class";
if (outputDir != null  !outputDir.equals(""))
classFileName = outputDir + File.separatorChar + classFileName;
   }
  @@ -154,63 +151,8 @@
   "try", "void", "volatile", "while"
   };
   
  -void computePackageName() {
  - String pathName = jsp.getPath();
  - StringBuffer modifiedpkgName = new StringBuffer ();
  -int indexOfSepChar = pathName.lastIndexOf(File.separatorChar);
  -
  -if (("".equals(ctxt.getServletPackageName())) ||
  - (indexOfSepChar == -1) || (indexOfSepChar == 0)) {
  - pkgName = null;
  - } else {
  - for (int i = 0; i  keywords.length; i++) {
  - char fs = File.separatorChar;
  - int index;
  - if (pathName.startsWith(keywords[i] + fs)) {
  - index = 0;
  - } else {
  - index = pathName.indexOf(fs + keywords[i] + fs);
  - }
  - while (index != -1) {
  - String tmpathName = pathName.substring (0,index+1) + '%';
  - pathName = tmpathName + pathName.substring (index+2);
  - index = pathName.indexOf(fs + keywords[i] + fs);
  - }
  - }
  - 
  - // XXX fix for paths containing '.'.
  - // Need to be more elegant here.
  -pathName = pathName.replace('.','_');
  - 
  - pkgName = pathName.substring(0, pathName.lastIndexOf(
  - File.separatorChar)).replace(File.separatorChar, '.');
  - if (ctxt.getServletPackageName() != null) {
  - pkgName = ctxt.getServletPackageName();
  - }
  - for

cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler Compiler.java

2001-02-03 Thread glenn

glenn   01/02/03 17:04:53

  Modified:jasper/src/share/org/apache/jasper/compiler Compiler.java
  Log:
  - Implemented Java SecurityManager
  - Switched to using URLClassLoader
  
  Jasper now creates a URLClassLoader for each JSP page and defers any other
  class loading to the web app context class loader.  Using a single class
  loader per JSP allowed me to remove all the code that increments the
  class version number, i.e. the work directory no longer has multiple
  *.java and *.class files for the same JSP page.  These changes also made
  it easy for me to put the java source and class files in the same directory
  tree as found in the web app context.  When Jasper is run in a servlet
  container it no longer puts the class files in a package, they are now
  in the default package.
  
  Revision  ChangesPath
  1.8   +7 -38 
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/Compiler.java
  
  Index: Compiler.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/Compiler.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Compiler.java 2001/01/05 22:33:02 1.7
  +++ Compiler.java 2001/02/04 01:04:52 1.8
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/Compiler.java,v
 1.7 2001/01/05 22:33:02 horwat Exp $
  - * $Revision: 1.7 $
  - * $Date: 2001/01/05 22:33:02 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/Compiler.java,v
 1.8 2001/02/04 01:04:52 glenn Exp $
  + * $Revision: 1.8 $
  + * $Date: 2001/02/04 01:04:52 $
*
* 
* 
  @@ -107,24 +107,17 @@
   public boolean compile()
   throws FileNotFoundException, JasperException, Exception 
   {
  -String pkgName = mangler.getPackageName();
   String classFileName = mangler.getClassFileName();
   
  -ctxt.setServletPackageName(pkgName);
  -Constants.message("jsp.message.package_name_is",
  -  new Object[] { (pkgName==null)?
  -  "[default package]":pkgName },
  -  Logger.DEBUG);
  -Constants.message("jsp.message.class_file_name_is",
  -  new Object[] { classFileName },
  +String className = mangler.getClassName();
  +ctxt.setServletClassName(className);
  +Constants.message("jsp.message.class_name_is",
  +  new Object[] { className },
 Logger.DEBUG);
   
if (!isOutDated())
   return false;
   
  - // Hack to avoid readign the class file every time -
  - // getClassName() is an _expensive_ operation, and it's needed only
  - // if isOutDated() return true. 
   String javaFileName = mangler.getJavaFileName();
   ctxt.setServletJavaFileName(javaFileName);
   
  @@ -132,12 +125,6 @@
 new Object[] { javaFileName },
 Logger.DEBUG);
   
  - String className = mangler.getClassName();
  -ctxt.setServletClassName(className);
  -Constants.message("jsp.message.class_name_is",
  -  new Object[] { className },
  -  Logger.DEBUG);
  -
   // Setup the ServletWriter
// We try UTF8 by default. If it fails, we use the java encoding 
// specified for JspServlet init parameter "javaEncoding".
  @@ -224,12 +211,10 @@
   listener.beginPageProcessing();
   listener.endPageProcessing();
   writer.close();
  -
// An XML input stream has been produced and can be validated
// by TagLibraryValidator classes 
((JspParseEventListener)listener).validate();
   
  -
   String classpath = ctxt.getClassPath(); 
   
   // I'm nuking
  @@ -296,9 +281,6 @@
   }
   
   String classFile = ctxt.getOutputDir() + File.separatorChar;
  -if (pkgName != null  !pkgName.equals(""))
  -classFile = classFile + pkgName.replace('.', File.separatorChar) + 
  -File.separatorChar;
   classFile = classFile + className + ".class";
   
   if (!classFile.equals(classFileName)) {
  @@ -317,17 +299,6 @@
   return true;
   }
   
  -public void computeServletClassName() {
  - // Hack to avoid readign the class file every time -
  - // getClassName() is an _expensive_ operation, and it's needed only
  - // if isOutDated() return true. 
  - String className = mangler.getClassName();
  -ctxt.setServletClassName(className);
  -Constants.message(&q

cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler JspCompiler.java

2001-02-03 Thread glenn

glenn   01/02/03 17:05:02

  Modified:jasper/src/share/org/apache/jasper/compiler JspCompiler.java
  Log:
  - Implemented Java SecurityManager
  - Switched to using URLClassLoader
  
  Jasper now creates a URLClassLoader for each JSP page and defers any other
  class loading to the web app context class loader.  Using a single class
  loader per JSP allowed me to remove all the code that increments the
  class version number, i.e. the work directory no longer has multiple
  *.java and *.class files for the same JSP page.  These changes also made
  it easy for me to put the java source and class files in the same directory
  tree as found in the web app context.  When Jasper is run in a servlet
  container it no longer puts the class files in a package, they are now
  in the default package.
  
  Revision  ChangesPath
  1.3   +6 -150
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspCompiler.java
  
  Index: JspCompiler.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspCompiler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JspCompiler.java  2001/01/05 22:33:02 1.2
  +++ JspCompiler.java  2001/02/04 01:05:02 1.3
  @@ -78,7 +78,7 @@
*/
   public class JspCompiler extends Compiler implements Mangler {
   
  -String pkgName, javaFileName, classFileName;
  +String javaFileName, classFileName;
   String realClassName;
   
   File jsp;
  @@ -86,7 +86,6 @@
   
   //ClassFileData cfd;
   boolean outDated;
  -static final int JSP_TOKEN_LEN= Constants.JSP_TOKEN.length();
   
   Logger.Helper loghelper = new Logger.Helper("JASPER_LOG", "JspCompiler");
   
  @@ -97,71 +96,12 @@
   this.outputDir = ctxt.getOutputDir();
   this.outDated = false;
   setMangler(this);
  -
  - // If the .class file exists and is outdated, compute a new
  - // class name
  - if( isOutDated() ) {
  - generateNewClassName();
  - }
   }
   
  -private void generateNewClassName() {
  - File classFile = new File(getClassFileName());
  - if (! classFile.exists()) {
  -  String prefix = getPrefix(jsp.getPath());
  -  realClassName= prefix + getBaseClassName() +
  -  Constants.JSP_TOKEN + "0";
  - return;
  - } 
  -
  - String cn=getRealClassName();
  - String baseClassName = cn.
  - substring(0, cn.lastIndexOf(Constants.JSP_TOKEN));
  - int jspTokenIdx=cn.lastIndexOf(Constants.JSP_TOKEN);
  - String versionS=cn.substring(jspTokenIdx + JSP_TOKEN_LEN,
  -  cn.length());
  - int number= Integer.valueOf(versionS).intValue();
  - number++;
  - realClassName = baseClassName + Constants.JSP_TOKEN + number;
  -}
  -
  -/** Return the real class name for the JSP, including package and
  - *   version.
  - *
  - *  This method is called when the server is started and a .class file
  - *  is found from a previous compile or when the .class file is older,
  - *  to find next version.
  - */
  -public final String getRealClassName() {
  - if( realClassName!=null ) return realClassName;
  -
  - //  loghelper.log("JspCompiler: extract class name and version ",
  - //null, Logger.DEBUG);
  -try {
  -realClassName = ClassName.getClassName( getClassFileName() );
  -} catch( JasperException ex) {
  -// ops, getClassName should throw something
  - loghelper.log("Exception in getRealClassName", ex);
  - return null;
  -}
  - return realClassName;
  -
  -}
  -
   public final String getClassName() {
  -// CFD gives you the whole class name
  -// This method returns just the class name sans the package
  -
  - String cn=getRealClassName();
  -int lastDot = cn.lastIndexOf('.');
  - String className=null;
  -if (lastDot != -1) 
  -className = cn.substring(lastDot+1,
  - cn.length());
  -else // no package name case
  -className = cn;
  -
  -return className;
  + if( realClassName == null )
  + realClassName = getBaseClassName();
  +return realClassName;
   }
   
   public final String getJavaFileName() {
  @@ -175,81 +115,12 @@
   public final String getClassFileName() {
   if( classFileName!=null) return classFileName;
   
  - //computeClassFileName();
  -String prefix = getPrefix(jsp.getPath());
  -classFileName = prefix + getBaseClassName() + ".class";
  +classFileName = getClassName() + ".class";
if (outputDir != null  !outputDir.

cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler JspParseEventListener.java

2001-02-03 Thread glenn

glenn   01/02/03 17:05:13

  Modified:jasper/src/share/org/apache/jasper/compiler
JspParseEventListener.java
  Log:
  - Implemented Java SecurityManager
  - Switched to using URLClassLoader
  
  Jasper now creates a URLClassLoader for each JSP page and defers any other
  class loading to the web app context class loader.  Using a single class
  loader per JSP allowed me to remove all the code that increments the
  class version number, i.e. the work directory no longer has multiple
  *.java and *.class files for the same JSP page.  These changes also made
  it easy for me to put the java source and class files in the same directory
  tree as found in the web app context.  When Jasper is run in a servlet
  container it no longer puts the class files in a package, they are now
  in the default package.
  
  Revision  ChangesPath
  1.22  +8 -10 
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspParseEventListener.java
  
  Index: JspParseEventListener.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspParseEventListener.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- JspParseEventListener.java2001/01/24 20:26:39 1.21
  +++ JspParseEventListener.java2001/02/04 01:05:13 1.22
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspParseEventListener.java,v
 1.21 2001/01/24 20:26:39 horwat Exp $
  - * $Revision: 1.21 $
  - * $Date: 2001/01/24 20:26:39 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JspParseEventListener.java,v
 1.22 2001/02/04 01:05:13 glenn Exp $
  + * $Revision: 1.22 $
  + * $Date: 2001/02/04 01:05:13 $
*
* 
*
  @@ -182,7 +182,6 @@
   // FIXME: Is this good enough? (I'm just taking the easy way out - akv)
   if (ctxt.getOptions().getLargeFile())
   dataFile = ctxt.getOutputDir() + File.separatorChar +
  -ctxt.getServletPackageName() + "_" +
   ctxt.getServletClassName() + ".dat";
   }
   
  @@ -235,7 +234,6 @@
   }
   
   private void generateAll(Class phase) throws JasperException {
  -
for(int i = 0; i  generators.size(); i++) {
   Generator gen = (Generator) generators.elementAt(i);
   if (phase.isInstance(gen)) {
  @@ -248,11 +246,11 @@
   private void generateHeader() throws JasperException {
   String servletPackageName = ctxt.getServletPackageName();
   String servletClassName = ctxt.getServletClassName();
  - // First the package name:
  - if (! "".equals(servletPackageName)  servletPackageName != null) {
  - writer.println("package "+servletPackageName+";");
  - writer.println();
  - }
  +// First the package name:
  +if (! "".equals(servletPackageName)  servletPackageName != null) {
  +writer.println("package "+servletPackageName+";");
  +writer.println();
  +}
   
Enumeration e = imports.elements();
while (e.hasMoreElements())
  
  
  

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




cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler Mangler.java

2001-02-03 Thread glenn

glenn   01/02/03 17:05:25

  Modified:jasper/src/share/org/apache/jasper/compiler Mangler.java
  Log:
  - Implemented Java SecurityManager
  - Switched to using URLClassLoader
  
  Jasper now creates a URLClassLoader for each JSP page and defers any other
  class loading to the web app context class loader.  Using a single class
  loader per JSP allowed me to remove all the code that increments the
  class version number, i.e. the work directory no longer has multiple
  *.java and *.class files for the same JSP page.  These changes also made
  it easy for me to put the java source and class files in the same directory
  tree as found in the web app context.  When Jasper is run in a servlet
  container it no longer puts the class files in a package, they are now
  in the default package.
  
  Revision  ChangesPath
  1.2   +3 -8  
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/Mangler.java
  
  Index: Mangler.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/Mangler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Mangler.java  2000/08/12 00:52:08 1.1
  +++ Mangler.java  2001/02/04 01:05:23 1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/Mangler.java,v
 1.1 2000/08/12 00:52:08 pierred Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/08/12 00:52:08 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/Mangler.java,v
 1.2 2001/02/04 01:05:23 glenn Exp $
  + * $Revision: 1.2 $
  + * $Date: 2001/02/04 01:05:23 $
*
* 
* 
  @@ -71,11 +71,6 @@
*  generated servlet, including the version number
*/
   String getClassName();
  -
  -/** The package name. It is based on the .jsp path, with
  - *  all unsafe components escaped.
  - */
  -String getPackageName();
   
   /** The full name of the .java file, including
*  version number ( based on className and outputDir )
  
  
  

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




cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler TagBeginGenerator.java

2001-02-03 Thread glenn

glenn   01/02/03 17:05:35

  Modified:jasper/src/share/org/apache/jasper/compiler
TagBeginGenerator.java
  Log:
  - Implemented Java SecurityManager
  - Switched to using URLClassLoader
  
  Jasper now creates a URLClassLoader for each JSP page and defers any other
  class loading to the web app context class loader.  Using a single class
  loader per JSP allowed me to remove all the code that increments the
  class version number, i.e. the work directory no longer has multiple
  *.java and *.class files for the same JSP page.  These changes also made
  it easy for me to put the java source and class files in the same directory
  tree as found in the web app context.  When Jasper is run in a servlet
  container it no longer puts the class files in a package, they are now
  in the default package.
  
  Revision  ChangesPath
  1.8   +0 -5  
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/TagBeginGenerator.java
  
  Index: TagBeginGenerator.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/TagBeginGenerator.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TagBeginGenerator.java2000/11/30 21:47:59 1.7
  +++ TagBeginGenerator.java2001/02/04 01:05:35 1.8
  @@ -318,26 +318,21 @@
   writer.println("/*   "+prefix+":"+shortTagName+"  */");
   
   writer.println(ti.getTagClassName()+" "+thVarName+" = new 
"+ti.getTagClassName()+"();");
  -
   generateSetters(writer, parent);
   
   VariableInfo[] vi = ti.getVariableInfo(tagData);
TagVariableInfo[] tvi = ti.getTagVariableInfos();
  -
   // Just declare AT_BEGIN here...
   declareVariables(writer, vi, tvi, tagData, true, false, 
VariableInfo.AT_BEGIN);
   
writer.println("try {");
writer.pushIndent();
   
  -
  -
   writer.println("int "+evalVar+" = "
  +thVarName+".doStartTag();");
   
   boolean implementsBodyTag = 
BodyTag.class.isAssignableFrom(tc.getTagHandlerClass());
  -
   // Need to update AT_BEGIN variables here
   declareVariables(writer, vi, tvi, tagData, false, true, 
VariableInfo.AT_BEGIN);
   
  
  
  

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




cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler TagLibraryInfoImpl.java

2001-02-03 Thread glenn

glenn   01/02/03 17:05:46

  Modified:jasper/src/share/org/apache/jasper/compiler
TagLibraryInfoImpl.java
  Log:
  - Implemented Java SecurityManager
  - Switched to using URLClassLoader
  
  Jasper now creates a URLClassLoader for each JSP page and defers any other
  class loading to the web app context class loader.  Using a single class
  loader per JSP allowed me to remove all the code that increments the
  class version number, i.e. the work directory no longer has multiple
  *.java and *.class files for the same JSP page.  These changes also made
  it easy for me to put the java source and class files in the same directory
  tree as found in the web app context.  When Jasper is run in a servlet
  container it no longer puts the class files in a package, they are now
  in the default package.
  
  Revision  ChangesPath
  1.18  +3 -4  
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java
  
  Index: TagLibraryInfoImpl.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- TagLibraryInfoImpl.java   2001/01/25 02:46:02 1.17
  +++ TagLibraryInfoImpl.java   2001/02/04 01:05:46 1.18
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java,v
 1.17 2001/01/25 02:46:02 horwat Exp $
  - * $Revision: 1.17 $
  - * $Date: 2001/01/25 02:46:02 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java,v
 1.18 2001/02/04 01:05:46 glenn Exp $
  + * $Revision: 1.18 $
  + * $Date: 2001/02/04 01:05:46 $
*
* The Apache Software License, Version 1.1
*
  @@ -95,7 +95,6 @@
   import org.apache.jasper.JspCompilationContext;
   import org.apache.jasper.JasperException;
   import org.apache.jasper.Constants;
  -//import org.apache.jasper.runtime.JspLoader;
   
   import org.apache.jasper.logging.Logger;
   
  
  
  

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




cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/logging JasperLogger.java

2001-02-03 Thread glenn

glenn   01/02/03 17:06:27

  Modified:jasper/src/share/org/apache/jasper/logging JasperLogger.java
  Log:
  - Implemented Java SecurityManager
  - Switched to using URLClassLoader
  
  Jasper now creates a URLClassLoader for each JSP page and defers any other
  class loading to the web app context class loader.  Using a single class
  loader per JSP allowed me to remove all the code that increments the
  class version number, i.e. the work directory no longer has multiple
  *.java and *.class files for the same JSP page.  These changes also made
  it easy for me to put the java source and class files in the same directory
  tree as found in the web app context.  When Jasper is run in a servlet
  container it no longer puts the class files in a package, they are now
  in the default package.
  
  Revision  ChangesPath
  1.4   +2 -17 
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/logging/JasperLogger.java
  
  Index: JasperLogger.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/logging/JasperLogger.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JasperLogger.java 2000/12/15 00:16:24 1.3
  +++ JasperLogger.java 2001/02/04 01:06:27 1.4
  @@ -163,23 +163,8 @@
   private void init() {
if (logDaemon == null || logQueue == null) {
logQueue = new Queue();
  -class createDaemon implements PrivilegedAction {
  -private Queue logQueue;
  -private ServletContext servletContext;
  -public createDaemon(Queue logQueue,
  -ServletContext servletContext) {
  -this.logQueue = logQueue;
  -this.servletContext = servletContext;
  -}
  -public Object run() {
  -LogDaemon logDaemon =
  -new LogDaemon(logQueue, servletContext);
  -logDaemon.start();
  -return (logDaemon);
  -}
  -}
  -createDaemon cd = new createDaemon(logQueue, servletContext);
  -logDaemon = (LogDaemon) AccessController.doPrivileged(cd);
  +LogDaemon logDaemon = new LogDaemon(logQueue, servletContext);
  +logDaemon.start();   
}
   }
   
  
  
  

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




cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/runtime HttpJspBase.java

2001-02-03 Thread glenn

glenn   01/02/03 17:06:49

  Modified:jasper/src/share/org/apache/jasper/runtime HttpJspBase.java
  Log:
  - Implemented Java SecurityManager
  - Switched to using URLClassLoader
  
  Jasper now creates a URLClassLoader for each JSP page and defers any other
  class loading to the web app context class loader.  Using a single class
  loader per JSP allowed me to remove all the code that increments the
  class version number, i.e. the work directory no longer has multiple
  *.java and *.class files for the same JSP page.  These changes also made
  it easy for me to put the java source and class files in the same directory
  tree as found in the web app context.  When Jasper is run in a servlet
  container it no longer puts the class files in a package, they are now
  in the default package.
  
  Revision  ChangesPath
  1.2   +0 -12 
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/runtime/HttpJspBase.java
  
  Index: HttpJspBase.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/runtime/HttpJspBase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HttpJspBase.java  2000/08/12 00:52:12 1.1
  +++ HttpJspBase.java  2001/02/04 01:06:49 1.2
  @@ -78,8 +78,6 @@
   extends HttpServlet 
   implements HttpJspPage 
   {
  -private ClassLoader cl;
  -
   protected PageContext pageContext;
   
   protected HttpJspBase() {
  @@ -98,16 +96,6 @@
   
   public final void destroy() {
jspDestroy();
  -}
  -
  -public final void setClassLoader(ClassLoader cl) {
  -this.cl = cl;
  -}
  -
  -protected ClassLoader getClassLoader() {
  - if (cl == null) 
  -return this.getClass().getClassLoader();
  - return cl;
   }
   
   /**
  
  
  

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




cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/runtime PageContextImpl.java

2001-02-03 Thread glenn

glenn   01/02/03 17:07:22

  Modified:jasper/src/share/org/apache/jasper/runtime
PageContextImpl.java
  Log:
  - Implemented Java SecurityManager
  - Switched to using URLClassLoader
  
  Jasper now creates a URLClassLoader for each JSP page and defers any other
  class loading to the web app context class loader.  Using a single class
  loader per JSP allowed me to remove all the code that increments the
  class version number, i.e. the work directory no longer has multiple
  *.java and *.class files for the same JSP page.  These changes also made
  it easy for me to put the java source and class files in the same directory
  tree as found in the web app context.  When Jasper is run in a servlet
  container it no longer puts the class files in a package, they are now
  in the default package.
  
  Revision  ChangesPath
  1.8   +3 -42 
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/runtime/PageContextImpl.java
  
  Index: PageContextImpl.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/runtime/PageContextImpl.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PageContextImpl.java  2000/11/26 16:13:57 1.7
  +++ PageContextImpl.java  2001/02/04 01:07:22 1.8
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/runtime/PageContextImpl.java,v
 1.7 2000/11/26 16:13:57 pierred Exp $
  - * $Revision: 1.7 $
  - * $Date: 2000/11/26 16:13:57 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/runtime/PageContextImpl.java,v
 1.8 2001/02/04 01:07:22 glenn Exp $
  + * $Revision: 1.8 $
  + * $Date: 2001/02/04 01:07:22 $
*
* 
*
  @@ -106,51 +106,12 @@
   this.factory = factory;
   }
   
  -/*
  -  static class InitAction implements java.security.PrivilegedAction {
  - Servlet servlet;
  - ServletRequest request;
  - ServletResponse response;
  - String errorPageURL;
  - boolean needsSession;
  - int bufferSize;
  - boolean autoFlush;
  - PageContextImpl pci;
  - 
  - InitAction(PageContextImpl pci, Servlet s, ServletRequest req,
  -ServletResponse res, String err,
  -boolean n, int b,
  -boolean a) {
  - this.pci=pci;
  - servlet=s;
  - request=req;
  - response=res;
  - errorPageURL=err;
  - needsSession=n;;
  - bufferSize=b;
  - autoFlush=a;
  - }
  - 
  - public Object run()  {
  - try {
  - pci._initialize(servlet, request, response, errorPageURL, 
needsSession, bufferSize, autoFlush);
  - } catch( Throwable t ) {
  - t. print Stack Trace();
  - }
  - return null;
  - }
  -}
  -*/
   public void initialize(Servlet servlet, ServletRequest request,
  ServletResponse response, String errorPageURL,
  boolean needsSession, int bufferSize,
  boolean autoFlush)
   throws IOException, IllegalStateException, IllegalArgumentException
   {
  - //  InitAction ia=new InitAction( this, servlet, request, response,
  - //errorPageURL, needsSession, 
bufferSize,
  - //autoFlush);
  - //  java.security.AccessController.doPrivileged( ia );
_initialize(servlet, request, response, errorPageURL, needsSession, 
bufferSize, autoFlush);
   }
   
  
  
  

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




cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet JasperLoader.java

2001-02-03 Thread glenn

glenn   01/02/03 17:07:44

  Modified:jasper/src/share/org/apache/jasper/servlet JasperLoader.java
  Log:
  - Implemented Java SecurityManager
  - Switched to using URLClassLoader
  
  Jasper now creates a URLClassLoader for each JSP page and defers any other
  class loading to the web app context class loader.  Using a single class
  loader per JSP allowed me to remove all the code that increments the
  class version number, i.e. the work directory no longer has multiple
  *.java and *.class files for the same JSP page.  These changes also made
  it easy for me to put the java source and class files in the same directory
  tree as found in the web app context.  When Jasper is run in a servlet
  container it no longer puts the class files in a package, they are now
  in the default package.
  
  Revision  ChangesPath
  1.2   +105 -227  
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet/JasperLoader.java
  
  Index: JasperLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet/JasperLoader.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JasperLoader.java 2000/08/12 00:52:14 1.1
  +++ JasperLoader.java 2001/02/04 01:07:44 1.2
  @@ -63,12 +63,13 @@
   import java.io.FileNotFoundException;
   import java.io.InputStream;
   import java.io.IOException;
  -
  +import java.net.URL;
  +import java.net.URLClassLoader;
  +import java.security.PermissionCollection;
   import java.util.Hashtable;
   import java.util.Vector;
   import java.util.zip.ZipFile;
   import java.util.zip.ZipEntry;
  -import java.net.URL;
   
   import java.security.*;
   
  @@ -86,250 +87,127 @@
* Java classes. It calls the compiler to compile the JSP file into a
* servlet and then loads the generated class. 
*
  - * This code is quite fragile and needs careful
  - * treatment/handling/revisiting. I know this doesn't work very well
  - * right now for:  
  - * 
  - *   (a) inner classes
  - *   (b) does not work at all for tag handlers that have inner
  - *  classes; but that is likely to change with the new JSP PR2
  - *  spec. 
  - *
* @author Anil K. Vijendran
* @author Harish Prabandham
*/
  -public class JasperLoader extends org.apache.jasper.runtime.JspLoader {
  -// ClassLoader parent;
  -// Options options;
  -Object pd;
  +public class JasperLoader extends URLClassLoader {
   
  -/*
  - * This should be factoried out
  - */
  -public JasperLoader() {
  - super();
  -}
  -
  -// public void setParentClassLoader( ClassLoader cl) 
  -// {
  -//   this.parent = cl;
  -// }
  -
  -// public void setOptions( Options options) {
  -//   this.options = options;
  -// }
  -
  -public void setProtectionDomain( Object pd ) {
  - this.pd=pd;
  -}
  -
  -protected synchronized Class loadClass(String name, boolean resolve)
  - throws ClassNotFoundException
  -{
  - if( debug0) log("load " + name );
  - // First, check if the class has already been loaded
  - Class c = findLoadedClass(name);
  - if (c == null) {
  - try {
  - if (parent != null) {
  - if(debug0) log("load from parent " + name );
  - c = parent.loadClass(name);
  -}
  - else {
  - if(debug0) log("load from system " + name );
  - c = findSystemClass(name);
  -}
  - } catch (ClassNotFoundException e) {
  - // If still not found, then call findClass in order
  - // to find the class.
  - try {
  - if(debug0) log("local jsp loading " + name );
  - c = findClass(name);
  - } catch (ClassNotFoundException ex) {
  - throw ex;
  - }
  - }
  - }
  - if (resolve) {
  - resolveClass(c);
  - }
  - return c;
  -}
  -public InputStream getResourceAsStream(String name) {
  - if( debug0) log("getResourcesAsStream()" + name );
  - URL url = getResource(name);
  - try {
  - return url != null ? url.openStream() : null;
  - } catch (IOException e) {
  - return null;
  - }
  +private PermissionCollection permissionCollection = null;
  +private String className = null;
  +private ClassLoader parent = null;
  +private SecurityManager securityManager = null;
  +
  +JasperLoader(URL [] urls, String className, ClassLoader parent,
  +  PermissionCollection permissionCollection) {
  + super(urls,parent);
  + this.permissionCollection = permissionCollection;
  + this.className = className;
  + this.parent = parent;
  + this.securityManager = System.getSecurityManager

cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet JspServlet.java

2001-02-03 Thread glenn

glenn   01/02/03 17:07:52

  Modified:jasper/src/share/org/apache/jasper/servlet JspServlet.java
  Log:
  - Implemented Java SecurityManager
  - Switched to using URLClassLoader
  
  Jasper now creates a URLClassLoader for each JSP page and defers any other
  class loading to the web app context class loader.  Using a single class
  loader per JSP allowed me to remove all the code that increments the
  class version number, i.e. the work directory no longer has multiple
  *.java and *.class files for the same JSP page.  These changes also made
  it easy for me to put the java source and class files in the same directory
  tree as found in the web app context.  When Jasper is run in a servlet
  container it no longer puts the class files in a package, they are now
  in the default package.
  
  Revision  ChangesPath
  1.10  +104 -83   
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet/JspServlet.java
  
  Index: JspServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet/JspServlet.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- JspServlet.java   2001/01/05 22:33:03 1.9
  +++ JspServlet.java   2001/02/04 01:07:51 1.10
  @@ -72,8 +72,15 @@
   import java.io.PrintWriter;
   import java.io.IOException;
   import java.io.FileNotFoundException;
  -
  +import java.io.FilePermission;
  +import java.lang.RuntimePermission;
  +import java.net.URL;
  +import java.net.URLClassLoader;
  +import java.net.MalformedURLException;
   import java.security.AccessController;
  +import java.security.CodeSource;
  +import java.security.PermissionCollection;
  +import java.security.Policy;
   import java.security.PrivilegedAction;
   
   import org.apache.jasper.JasperException;
  @@ -94,6 +101,13 @@
   /**
* The JSP engine (a.k.a Jasper)! 
*
  + * The servlet container is responsible for providing a
  + * URLClassLoader for the web application context Jasper
  + * is being used in. Jasper will try get the Tomcat
  + * ServletContext attribute for its ServletContext class
  + * loader, if that fails, it uses the parent class loader.
  + * In either case, it must be a URLClassLoader.
  + *
* @author Anil K. Vijendran
* @author Harish Prabandham
*/
  @@ -107,6 +121,7 @@
boolean isErrorPage;
// ServletWrapper will set this 
Class servletClass;
  + URLClassLoader loader = null;

JspServletWrapper(String jspUri, boolean isErrorPage) {
this.jspUri = jspUri;
  @@ -116,7 +131,6 @@

private void load() throws JasperException, ServletException {
try {
  - // Class servletClass = (Class) loadedJSPs.get(jspUri);
// This is to maintain the original protocol.
destroy();
   
  @@ -125,10 +139,12 @@
throw new JasperException(ex);
}
theServlet.init(JspServlet.this.config);
  +/*   Shouldn't be needed after switching to URLClassLoader
if (theServlet instanceof HttpJspBase)  {
   HttpJspBase h = (HttpJspBase) theServlet;
   h.setClassLoader(JspServlet.this.parentClassLoader);
}
  +*/
}

private void loadIfNecessary(HttpServletRequest req, HttpServletResponse res) 
  @@ -218,23 +234,14 @@

   protected ServletContext context = null;
   protected Hashtable jsps = new Hashtable();
  -//protected Hashtable loadedJSPs = new Hashtable();
   protected ServletConfig config;
  -protected JasperLoader loader;
   protected Options options;
  -protected ClassLoader parentClassLoader;
  +protected URLClassLoader parentClassLoader;
   protected ServletEngine engine;
   protected String serverInfo;
  +private PermissionCollection permissionCollection = null;
   
   static boolean firstTime = true;
  -static boolean jdk12=false;
  -static {
  - try {
  - Class.forName( "java.security.PrivilegedAction" );
  - jdk12=true;
  - } catch(Throwable ex ) {
  - }
  -}
   
   public void init(ServletConfig config)
throws ServletException
  @@ -254,55 +261,73 @@
   
options = new EmbededServletOptions(config, context);
   
  - parentClassLoader = (ClassLoader) 
context.getAttribute(Constants.SERVLET_CLASS_LOADER);
  - if (parentClassLoader == null)
  - parentClassLoader = this.getClass().getClassLoader();
  -
  - // getClass().getClassLoader() returns null in JDK 1.1.6/1.1.8
  - if (parentClassLoader != null) {
  -Constants.message("jsp.message.parent_class_loader_is", 
  + // Get the parent class loader
  + parentClassLoader =
  + (URLClassLoader)context.getAttribute(Constants.SERVLET_CLASS_LOADER);
  +if (paren

cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/runtime JspLoader.java

2001-02-03 Thread glenn

glenn   01/02/03 17:10:47

  Removed: jasper/src/share/org/apache/jasper/runtime JspLoader.java
  Log:
  - Implemented Java SecurityManager
  - Switched to using URLClassLoader
  
  Jasper now creates a URLClassLoader for each JSP page and defers any other
  class loading to the web app context class loader.  Using a single class
  loader per JSP allowed me to remove all the code that increments the
  class version number, i.e. the work directory no longer has multiple
  *.java and *.class files for the same JSP page.  These changes also made
  it easy for me to put the java source and class files in the same directory
  tree as found in the web app context.  When Jasper is run in a servlet
  container it no longer puts the class files in a package, they are now
  in the default package.

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




cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler ClassName.java

2001-02-03 Thread glenn

glenn   01/02/03 17:11:18

  Removed: jasper/src/share/org/apache/jasper/compiler ClassName.java
  Log:
  - Implemented Java SecurityManager
  - Switched to using URLClassLoader
  
  Jasper now creates a URLClassLoader for each JSP page and defers any other
  class loading to the web app context class loader.  Using a single class
  loader per JSP allowed me to remove all the code that increments the
  class version number, i.e. the work directory no longer has multiple
  *.java and *.class files for the same JSP page.  These changes also made
  it easy for me to put the java source and class files in the same directory
  tree as found in the web app context.  When Jasper is run in a servlet
  container it no longer puts the class files in a package, they are now
  in the default package.

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




cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper CommandLineContext.java

2001-02-08 Thread glenn

glenn   01/02/08 05:36:56

  Modified:jasper/src/share/org/apache/jasper CommandLineContext.java
  Log:
  Put runtime jsp page servlets in a package
  
  Revision  ChangesPath
  1.6   +12 -3 
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/CommandLineContext.java
  
  Index: CommandLineContext.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/CommandLineContext.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CommandLineContext.java   2001/02/04 01:03:04 1.5
  +++ CommandLineContext.java   2001/02/08 13:36:56 1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/CommandLineContext.java,v
 1.5 2001/02/04 01:03:04 glenn Exp $
  - * $Revision: 1.5 $
  - * $Date: 2001/02/04 01:03:04 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/CommandLineContext.java,v
 1.6 2001/02/08 13:36:56 glenn Exp $
  + * $Revision: 1.6 $
  + * $Date: 2001/02/08 13:36:56 $
*
* 
* 
  @@ -187,6 +187,15 @@
   return options.getScratchDir().toString();
   }
   
  +/**
  + * What is the scratch directory we are generating code into?
  + * FIXME: In some places this is called scratchDir and in some
  + * other places it is called outputDir.
  + */
  +public String getJavacOutputDir() {
  +return options.getScratchDir().toString();
  +}
  +
   /**
* Path of the JSP URI. Note that this is not a file name. This is
* the context rooted URI of the JSP file. 
  
  
  

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




cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper Constants.java

2001-02-08 Thread glenn

glenn   01/02/08 05:37:08

  Modified:jasper/src/share/org/apache/jasper Constants.java
  Log:
  Put runtime jsp page servlets in a package
  
  Revision  ChangesPath
  1.8   +5 -0  
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/Constants.java
  
  Index: Constants.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/Constants.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Constants.java2001/02/04 01:03:17 1.7
  +++ Constants.java2001/02/08 13:37:08 1.8
  @@ -129,6 +129,11 @@
   public static final String PRECOMPILE = "jsp_precompile";
   
   /**
  + * The default package name for compiled jsp pages.
  + */
  +public static final String JSP_PACKAGE_NAME = "org.apache.jsp";
  +
  +/**
* Servlet context and request attributes that the JSP engine
* uses. 
*/
  
  
  

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




cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper JspCompilationContext.java

2001-02-08 Thread glenn

glenn   01/02/08 05:37:16

  Modified:jasper/src/share/org/apache/jasper
JspCompilationContext.java
  Log:
  Put runtime jsp page servlets in a package
  
  Revision  ChangesPath
  1.5   +10 -3 
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspCompilationContext.java
  
  Index: JspCompilationContext.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspCompilationContext.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JspCompilationContext.java2001/02/04 01:03:52 1.4
  +++ JspCompilationContext.java2001/02/08 13:37:16 1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspCompilationContext.java,v
 1.4 2001/02/04 01:03:52 glenn Exp $
  - * $Revision: 1.4 $
  - * $Date: 2001/02/04 01:03:52 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspCompilationContext.java,v
 1.5 2001/02/08 13:37:16 glenn Exp $
  + * $Revision: 1.5 $
  + * $Date: 2001/02/08 13:37:16 $
*
* 
* 
  @@ -118,6 +118,13 @@
*/
   public String getOutputDir();
   
  +/**
  + * What is the scratch directory we are generating code into?
  + * FIXME: In some places this is called scratchDir and in some
  + * other places it is called outputDir.
  + */
  +public String getJavacOutputDir();
  +
   /**
* Path of the JSP URI. Note that this is not a file name. This is
* the context rooted URI of the JSP file. 
  
  
  

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




cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper JspEngineContext.java

2001-02-08 Thread glenn

glenn   01/02/08 05:37:27

  Modified:jasper/src/share/org/apache/jasper JspEngineContext.java
  Log:
  Put runtime jsp page servlets in a package
  
  Revision  ChangesPath
  1.5   +13 -4 
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspEngineContext.java
  
  Index: JspEngineContext.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspEngineContext.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JspEngineContext.java 2001/02/04 01:04:02 1.4
  +++ JspEngineContext.java 2001/02/08 13:37:27 1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspEngineContext.java,v
 1.4 2001/02/04 01:04:02 glenn Exp $
  - * $Revision: 1.4 $
  - * $Date: 2001/02/04 01:04:02 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspEngineContext.java,v
 1.5 2001/02/08 13:37:27 glenn Exp $
  + * $Revision: 1.5 $
  + * $Date: 2001/02/08 13:37:27 $
*
* 
* 
  @@ -104,7 +104,7 @@
   String jspFile;
   String outDir;
   String servletClassName;
  -String servletPackageName;
  +String servletPackageName = Constants.JSP_PACKAGE_NAME;
   String servletJavaFileName;
   String contentType;
   Options options;
  @@ -204,6 +204,15 @@
   return outDir;
   }
   
  +/**
  + * What is the scratch directory we are generating code into?
  + * FIXME: In some places this is called scratchDir and in some
  + * other places it is called outputDir.
  + */
  +public String getJavacOutputDir() {
  +return null;
  +}
  +
   /**
* Path of the JSP URI. Note that this is not a file name. This is
* the context rooted URI of the JSP file. 
  
  
  

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




cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler Compiler.java

2001-02-08 Thread glenn

glenn   01/02/08 05:37:45

  Modified:jasper/src/share/org/apache/jasper/compiler Compiler.java
  Log:
  Put runtime jsp page servlets in a package
  
  Revision  ChangesPath
  1.9   +6 -24 
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/Compiler.java
  
  Index: Compiler.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/Compiler.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Compiler.java 2001/02/04 01:04:52 1.8
  +++ Compiler.java 2001/02/08 13:37:45 1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/Compiler.java,v
 1.8 2001/02/04 01:04:52 glenn Exp $
  - * $Revision: 1.8 $
  - * $Date: 2001/02/04 01:04:52 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/Compiler.java,v
 1.9 2001/02/08 13:37:45 glenn Exp $
  + * $Revision: 1.9 $
  + * $Date: 2001/02/08 13:37:45 $
*
* 
* 
  @@ -227,8 +227,7 @@
   "-encoding",
   javaEncoding,
   "-classpath",
  -System.getProperty("java.class.path")+ sep + classpath 
  -+ sep + ctxt.getOutputDir(),
  +System.getProperty("java.class.path")+ sep + classpath,
   "-d", ctxt.getOutputDir(),
   javaFileName
   };
  @@ -259,9 +258,8 @@
* Configure the compiler object
*/
   javac.setEncoding(javaEncoding);
  -javac.setClasspath( System.getProperty("java.class.path")+ sep + 
  -classpath + sep + ctxt.getOutputDir());
  -javac.setOutputDir(ctxt.getOutputDir());
  +javac.setClasspath( System.getProperty("java.class.path")+ sep + classpath);
  +javac.setOutputDir(ctxt.getJavacOutputDir());
   javac.setMsgOutput(out);
   
   /**
  @@ -278,22 +276,6 @@
   String msg = out.toString ();
   throw new 
JasperException(Constants.getString("jsp.error.unable.compile")
 + msg);
  -}
  -
  -String classFile = ctxt.getOutputDir() + File.separatorChar;
  -classFile = classFile + className + ".class";
  -
  -if (!classFile.equals(classFileName)) {
  -File classFileObject = new File(classFile);
  -File myClassFileObject = new File(classFileName);
  -if (myClassFileObject.exists())
  -myClassFileObject.delete();
  -if (classFileObject.renameTo(myClassFileObject) == false)
  -throw new 
JasperException(Constants.getString("jsp.error.unable.rename",
  -  new Object[] { 
  -  classFileObject, 
  -  myClassFileObject
  -  }));
   }
   
   return true;
  
  
  

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




cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler JikesJavaCompiler.java

2001-02-08 Thread glenn

glenn   01/02/08 05:37:55

  Modified:jasper/src/share/org/apache/jasper/compiler
JikesJavaCompiler.java
  Log:
  Put runtime jsp page servlets in a package
  
  Revision  ChangesPath
  1.4   +23 -11
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JikesJavaCompiler.java
  
  Index: JikesJavaCompiler.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JikesJavaCompiler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JikesJavaCompiler.java2000/11/24 13:38:33 1.3
  +++ JikesJavaCompiler.java2001/02/08 13:37:54 1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JikesJavaCompiler.java,v
 1.3 2000/11/24 13:38:33 pierred Exp $
  - * $Revision: 1.3 $
  - * $Date: 2000/11/24 13:38:33 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/JikesJavaCompiler.java,v
 1.4 2001/02/08 13:37:54 glenn Exp $
  + * $Revision: 1.4 $
  + * $Date: 2001/02/08 13:37:54 $
*
* 
*
  @@ -153,14 +153,26 @@
   } 
   }
   
  -String[] compilerCmd = new String[] {
  -  quote + compilerPath + quote,
  -  //XXX - add encoding once Jikes supports it
  -  "-classpath", quote + classpath + MicrosoftClasspath + quote,
  -  "-d", quote + outdir + quote,
  -  "-nowarn",
  -  quote + source + quote
  -};
  +String[] compilerCmd = null;
  +
  + if( outdir != null ) {
  + compilerCmd = new String[] {
  + quote + compilerPath + quote,
  + //XXX - add encoding once Jikes supports it
  + "-classpath", quote + classpath + MicrosoftClasspath + quote,
  + "-d", quote + outdir + quote,
  + "-nowarn",
  + quote + source + quote
  +};
  + } else {
  +compilerCmd = new String[] {
  +quote + compilerPath + quote,
  +//XXX - add encoding once Jikes supports it
  +"-classpath", quote + classpath + MicrosoftClasspath + quote,
  +"-nowarn",
  +quote + source + quote
  +};
  + }
   
   ByteArrayOutputStream tmpErr = new 
ByteArrayOutputStream(OUTPUT_BUFFER_SIZE);
try {
  
  
  

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




cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler SunJavaCompiler.java

2001-02-08 Thread glenn

glenn   01/02/08 05:38:03

  Modified:jasper/src/share/org/apache/jasper/compiler
SunJavaCompiler.java
  Log:
  Put runtime jsp page servlets in a package
  
  Revision  ChangesPath
  1.2   +20 -10
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/SunJavaCompiler.java
  
  Index: SunJavaCompiler.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/SunJavaCompiler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SunJavaCompiler.java  2000/08/12 00:52:08 1.1
  +++ SunJavaCompiler.java  2001/02/08 13:38:02 1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/SunJavaCompiler.java,v
 1.1 2000/08/12 00:52:08 pierred Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/08/12 00:52:08 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/SunJavaCompiler.java,v
 1.2 2001/02/08 13:38:02 glenn Exp $
  + * $Revision: 1.2 $
  + * $Date: 2001/02/08 13:38:02 $
*
* 
* 
  @@ -126,14 +126,24 @@
   
   public boolean compile(String source) {
   Main compiler = new Main(out, "jsp-javac");
  + String[] args = null;
   
  -String[] args = new String[]
  -{
  -"-encoding", encoding,
  -"-classpath", classpath,
  -"-d", outdir,
  -source
  -};
  + if( outdir != null ) {
  +args = new String[]
  +{
  +"-encoding", encoding,
  +"-classpath", classpath,
  +"-d", outdir,
  +source
  +};
  + } else {
  +args = new String[]
  +{
  +"-encoding", encoding,
  +"-classpath", classpath,
  +source   
  +};
  + }
   
   return compiler.compile(args);
   }
  
  
  

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




cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet JasperLoader.java

2001-02-08 Thread glenn

glenn   01/02/08 05:38:25

  Modified:jasper/src/share/org/apache/jasper/servlet JasperLoader.java
  Log:
  Put runtime jsp page servlets in a package
  
  Revision  ChangesPath
  1.3   +46 -14
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet/JasperLoader.java
  
  Index: JasperLoader.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet/JasperLoader.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JasperLoader.java 2001/02/04 01:07:44 1.2
  +++ JasperLoader.java 2001/02/08 13:38:24 1.3
  @@ -57,22 +57,15 @@
   
   package org.apache.jasper.servlet;
   
  -import java.io.FileInputStream;
   import java.io.ByteArrayOutputStream;
  -import java.io.File;
  -import java.io.FileNotFoundException;
   import java.io.InputStream;
   import java.io.IOException;
   import java.net.URL;
   import java.net.URLClassLoader;
  +import java.security.CodeSource;
   import java.security.PermissionCollection;
  -import java.util.Hashtable;
  -import java.util.Vector;
  -import java.util.zip.ZipFile;
  -import java.util.zip.ZipEntry;
  +import java.security.ProtectionDomain;
   
  -import java.security.*;
  -
   import org.apache.jasper.JasperException;
   import org.apache.jasper.Constants;
   import org.apache.jasper.JspCompilationContext;
  @@ -93,14 +86,17 @@
   public class JasperLoader extends URLClassLoader {
   
   private PermissionCollection permissionCollection = null;
  +private CodeSource codeSource = null;
   private String className = null;
   private ClassLoader parent = null;
   private SecurityManager securityManager = null;
   
   JasperLoader(URL [] urls, String className, ClassLoader parent,
  -  PermissionCollection permissionCollection) {
  +  PermissionCollection permissionCollection,
  +  CodeSource codeSource) {
super(urls,parent);
this.permissionCollection = permissionCollection;
  + this.codeSource = codeSource;
this.className = className;
this.parent = parent;
this.securityManager = System.getSecurityManager();
  @@ -176,16 +172,27 @@
   }
   
// Class is in a package, delegate to parent
  - if( dot = 0 ) {
  + if( !name.startsWith(Constants.JSP_PACKAGE_NAME) ) {
clazz = parent.loadClass(name);
if( resolve )
resolveClass(clazz);
return clazz;
}
   
  - // Only load unpackaged classes for the JSP page itself
  - if( name.startsWith(className) ) {
  - clazz = findClass(name);
  + // Only load classes for this JSP page
  + if( name.startsWith(Constants.JSP_PACKAGE_NAME + "." + className) ) {
  + String classFile = name.substring(Constants.JSP_PACKAGE_NAME.length()+1) +
  + ".class";
  + byte [] cdata = loadClassDataFromFile(classFile);
  + if( cdata == null )
  + throw new ClassNotFoundException(name);
  + if( System.getSecurityManager() != null ) {
  + ProtectionDomain pd = new ProtectionDomain(
  + codeSource,permissionCollection);
  + clazz = defineClass(name,cdata,0,cdata.length,pd);
  + } else {
  + clazz = defineClass(name,cdata,0,cdata.length);
  + }
if( clazz != null ) {
if( resolve )
resolveClass(clazz);
  @@ -208,6 +215,31 @@
*/
   protected final PermissionCollection getPermissions(CodeSource codeSource) {
   return permissionCollection;
  +}
  +
  +
  +/**
  + * Load JSP class data from file.
  + */
  +protected byte[] loadClassDataFromFile(String fileName) {
  +byte[] classBytes = null;
  +try {
  +InputStream in = getResourceAsStream(fileName);
  +if (in == null) {
  + return null;
  + }
  +ByteArrayOutputStream baos = new ByteArrayOutputStream();
  +byte buf[] = new byte[1024];
  +for(int i = 0; (i = in.read(buf)) != -1; )
  +baos.write(buf, 0, i);
  +in.close(); 
  +baos.close();
  +classBytes = baos.toByteArray();
  +} catch(Exception ex) {
  + ex.printStackTrace();
  +return null; 
  +}
  +return classBytes;
   }
   
   }
  
  
  

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




cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet JspServlet.java

2001-02-08 Thread glenn

glenn   01/02/08 05:38:38

  Modified:jasper/src/share/org/apache/jasper/servlet JspServlet.java
  Log:
  Put runtime jsp page servlets in a package
  
  Revision  ChangesPath
  1.12  +8 -4  
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet/JspServlet.java
  
  Index: JspServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet/JspServlet.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- JspServlet.java   2001/02/07 01:38:27 1.11
  +++ JspServlet.java   2001/02/08 13:38:38 1.12
  @@ -240,6 +240,7 @@
   protected ServletEngine engine;
   protected String serverInfo;
   private PermissionCollection permissionCollection = null;
  +private CodeSource codeSource = null;
   
   static boolean firstTime = true;
   
  @@ -288,8 +289,8 @@
   try {  
// Get the permissions for the web app context
URL url = options.getScratchDir().toURL();
  - CodeSource cs = new CodeSource(url,null);
  - permissionCollection = policy.getPermissions(cs);
  + codeSource = new CodeSource(url,null);
  + permissionCollection = policy.getPermissions(codeSource);
// Create a file read permission for web app context directory
String contextDir = url.getFile();
if( contextDir.endsWith(File.separator) )
  @@ -520,8 +521,11 @@
   File outputDir = new File(normalize(ctxt.getOutputDir()));
   urls[0] = outputDir.toURL();
   jsw.loader = new JasperLoader(urls,ctxt.getServletClassName(),
  -   parentClassLoader,permissionCollection);
  - jsw.servletClass = jsw.loader.loadClass(ctxt.getServletClassName());
  +   parentClassLoader,
  +   permissionCollection,
  +   codeSource);
  + jsw.servletClass = jsw.loader.loadClass(
  + Constants.JSP_PACKAGE_NAME + "." + ctxt.getServletClassName());
} catch (ClassNotFoundException cex) {
throw new JasperException(
Constants.getString("jsp.error.unable.load"),cex);
  
  
  

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




cvs commit: jakarta-tomcat-4.0/catalina/src/conf catalina.policy

2001-02-18 Thread glenn

glenn   01/02/18 09:18:41

  Modified:catalina/src/conf catalina.policy
  Log:
  Update policy for Craig's jasper class loading changes
  
  Revision  ChangesPath
  1.4   +5 -1  jakarta-tomcat-4.0/catalina/src/conf/catalina.policy
  
  Index: catalina.policy
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/conf/catalina.policy,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- catalina.policy   2001/02/03 16:42:39 1.3
  +++ catalina.policy   2001/02/18 17:18:40 1.4
  @@ -8,7 +8,7 @@
   //
   // * Read access to the document root directory
   //
  -// $Id: catalina.policy,v 1.3 2001/02/03 16:42:39 glenn Exp $
  +// $Id: catalina.policy,v 1.4 2001/02/18 17:18:40 glenn Exp $
   // 
   
   
  @@ -49,6 +49,10 @@
   permission java.security.AllPermission;
   };
   
  +// These permissions apply to the jasper page compiler
  +grant codeBase "file:${catalina.home}/jasper/-" {
  +permission java.security.AllPermission;
  +};
   
   // These permissions apply to all extension libraries (including Jasper,
   // if present) installed in the "lib" directory
  
  
  

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




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardWrapper.java

2001-02-18 Thread glenn

glenn   01/02/18 17:13:59

  Modified:catalina/src/share/org/apache/catalina/core
StandardWrapper.java
  Log:
  Patch for Java SecurityManager to work with Craig's new Jasper class loading
  
  Revision  ChangesPath
  1.14  +13 -5 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapper.java
  
  Index: StandardWrapper.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapper.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- StandardWrapper.java  2001/02/18 02:18:13 1.13
  +++ StandardWrapper.java  2001/02/19 01:13:57 1.14
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapper.java,v
 1.13 2001/02/18 02:18:13 craigmcc Exp $
  - * $Revision: 1.13 $
  - * $Date: 2001/02/18 02:18:13 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapper.java,v
 1.14 2001/02/19 01:13:57 glenn Exp $
  + * $Revision: 1.14 $
  + * $Date: 2001/02/19 01:13:57 $
*
* 
*
  @@ -104,7 +104,7 @@
* make them efficient are counter-productive.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.13 $ $Date: 2001/02/18 02:18:13 $
  + * @version $Revision: 1.14 $ $Date: 2001/02/19 01:13:57 $
*/
   
   public final class StandardWrapper
  @@ -726,8 +726,16 @@
   
   // Special case class loader for the Jasper JSP servlet
   if (this.name.equals(Constants.JSP_SERVLET_NAME)) {
  -if (jasperLoader == null)
  +if (jasperLoader == null) {
   jasperLoader = createJasperLoader(classLoader);
  + // Preload below class to prevent defineClassInPackage
  + // SecurityManager AccessControlException
  + try {
  +jasperLoader.loadClass(
  +"org.apache.jasper.runtime.ServletResponseWrapperInclude");
  + } catch(ClassNotFoundException e) {
  + }
  + }
   classLoader = jasperLoader;
   }
   
  
  
  

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




cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet JspServlet.java

2001-02-18 Thread glenn

glenn   01/02/18 17:14:24

  Modified:jasper/src/share/org/apache/jasper/servlet JspServlet.java
  Log:
  Patch for Java SecurityManager to work with Craig's new Jasper class loading
  
  Revision  ChangesPath
  1.13  +4 -1  
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet/JspServlet.java
  
  Index: JspServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet/JspServlet.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- JspServlet.java   2001/02/08 13:38:38 1.12
  +++ JspServlet.java   2001/02/19 01:14:23 1.13
  @@ -325,8 +325,11 @@
   parentClassLoader.loadClass( basePackage +
   "servlet.JspServlet$JspServletWrapper");
   parentClassLoader.loadClass( basePackage +
  - "compiler.ServletResponseWrapperInclude");
  + "runtime.ServletResponseWrapperInclude");
} catch (ClassNotFoundException ex) {
  + System.out.println(
  + "Jasper JspServlet preload of class failed: " +
  + ex.getMessage());
}
}
Constants.message("jsp.message.scratch.dir.is", 
  
  
  

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




cvs commit: jakarta-tomcat-4.0 build.xml

2001-02-20 Thread glenn

glenn   01/02/20 19:37:27

  Modified:.build.xml
  Log:
  Cleaned up library/class locations
  
  Revision  ChangesPath
  1.19  +8 -2  jakarta-tomcat-4.0/build.xml
  
  Index: build.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/build.xml,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- build.xml 2001/02/18 02:18:13 1.18
  +++ build.xml 2001/02/21 03:37:26 1.19
  @@ -60,6 +60,9 @@
   mkdir dir="${tomcat.dist}/lib"/
   mkdir dir="${tomcat.dist}/logs"/
   mkdir dir="${tomcat.dist}/server"/
  +mkdir dir="${tomcat.dist}/server/lib"/
  +mkdir dir="${tomcat.dist}/common"/
  +mkdir dir="${tomcat.dist}/common/lib"/
   mkdir dir="${tomcat.dist}/webapps"/
   mkdir dir="${tomcat.dist}/work"/
 /target
  @@ -85,11 +88,14 @@
   copy todir="${tomcat.dist}/jasper"
 fileset dir="${tomcat.build}/jasper" /
   /copy
  +copy todir="${tomcat.dist}/common/lib"
  +  fileset dir="${tomcat.build}/common/lib" /
  +/copy
   copy todir="${tomcat.dist}/lib"
 fileset dir="${tomcat.build}/lib" /
   /copy
  -copy todir="${tomcat.dist}/server"
  -  fileset dir="${tomcat.build}/server" /
  +copy todir="${tomcat.dist}/server/lib"
  +  fileset dir="${tomcat.build}/server/lib" /
   /copy
   fixcrlf srcdir="${tomcat.dist}/bin"   includes="*.sh" cr="remove"/
   fixcrlf srcdir="${tomcat.dist}/bin"   includes="*.bat" cr="add"/
  
  
  

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




cvs commit: jakarta-tomcat-4.0/catalina build.xml

2001-02-20 Thread glenn

glenn   01/02/20 19:37:45

  Modified:catalina build.xml
  Log:
  Cleaned up library/class locations
  
  Revision  ChangesPath
  1.31  +30 -19jakarta-tomcat-4.0/catalina/build.xml
  
  Index: build.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/build.xml,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- build.xml 2001/02/01 19:07:44 1.30
  +++ build.xml 2001/02/21 03:37:45 1.31
  @@ -31,7 +31,10 @@
   mkdir dir="${catalina.build}/classes"/
   mkdir dir="${catalina.build}/conf"/
   mkdir dir="${catalina.build}/lib"/
  +mkdir dir="${catalina.build}/common"/
  +mkdir dir="${catalina.build}/common/lib"/
   mkdir dir="${catalina.build}/server"/
  +mkdir dir="${catalina.build}/server/lib"/
 /target
   
   
  @@ -55,30 +58,30 @@
 /fileset
   /copy
   
  -!-- Shared Extensions --
  +!-- Common Extensions --
   !--   All applications need the servlet API classes --
  -copy file="${servlet.jar}" tofile="${catalina.build}/bin/servlet.jar" /
  +copy file="${servlet.jar}" tofile="${catalina.build}/common/lib/servlet.jar" /
   !--   Copy the JNDI JAR file for use under JDK 1.2.2 --
  -copy file="${jndi.jar}"tofile="${catalina.build}/bin/jndi.jar" /
  +copy file="${jndi.jar}"tofile="${catalina.build}/common/lib/jndi.jar" /
   
   !-- Server Components --
   !--   Catalina needs JAXP compliant XML parser --
   copy file="${parser.jar}" 
  - tofile="${catalina.build}/server/${catalina.jaxp.parser.jar}" /
  + tofile="${catalina.build}/server/lib/${catalina.jaxp.parser.jar}" /
   !--   Catalina needs the regular expression library --
  -copy todir="${catalina.build}/server"
  +copy todir="${catalina.build}/server/lib"
 fileset dir="${regexp.home}" includes="*.jar"/
   /copy
   !--   Catalina needs the JSSE packages --
   !--
  -copy file="${jcert.jar}" tofile="${catalina.build}/server/jcert.jar"/
  -copy file="${jnet.jar}" tofile="${catalina.build}/server/jnet.jar"/
  -copy file="${jsse.jar}" tofile="${catalina.build}/server/jsse.jar"/
  +copy file="${jcert.jar}" tofile="${catalina.build}/server/lib/jcert.jar"/
  +copy file="${jnet.jar}" tofile="${catalina.build}/server/lib/jnet.jar"/
  +copy file="${jsse.jar}" tofile="${catalina.build}/server/lib/jsse.jar"/
   --
 /target
   
 target name="copy-jaxp-jar" if="jaxp.jar.present" 
  -copy file="${jaxp.jar}" tofile="${catalina.build}/server/jaxp.jar"/
  +copy file="${jaxp.jar}" tofile="${catalina.build}/server/lib/jaxp.jar"/
 /target
   
   
  @@ -123,7 +126,7 @@
  basedir="${catalina.build}/classes"
  
includes="org/apache/catalina/startup/Bootstrap.class,org/apache/catalina/loader/**" 
  /
  -jar   jarfile="${catalina.build}/bin/naming.jar"
  +jar   jarfile="${catalina.build}/common/lib/naming.jar"
  basedir="${catalina.build}/classes"
  includes="**/org/apache/naming/**" 
  excludes="**/org/apache/naming/factory/**"
  @@ -170,7 +173,10 @@
   mkdir dir="${catalina.deploy}/conf"/
   mkdir dir="${catalina.deploy}/lib"/
   mkdir dir="${catalina.deploy}/logs"/
  +mkdir dir="${catalina.deploy}/common"/
  +mkdir dir="${catalina.deploy}/common/lib"/
   mkdir dir="${catalina.deploy}/server"/
  +mkdir dir="${catalina.deploy}/server/lib"/
   mkdir dir="${catalina.deploy}/work"/
 /target
   
  @@ -198,9 +204,14 @@
 fileset dir="${catalina.build}/lib" /
   /copy
   
  +!-- Common Extensions --
  +copy todir="${catalina.deploy}/common/lib"
  +  fileset dir="${catalina.build}/common/lib" /
  +/copy
  +
   !-- Server Components --
  -copy todir="${catalina.deploy}/server"
  -  fileset dir="${catalina.build}/server" /
  +copy todir="${catalina.deploy}/server/lib"
  +  fileset dir="${catalina.build}/server/lib" /
   /copy
   
 /target
  @@ -208,10 +219,10 @@
   
 !-- == DEPLOY: Create Catalina JAR = --
 target name="deploy-main" depends="deploy-static"
  -jar  jarfile="${catalina.deploy}/server/catalina.jar"
  +   

cvs commit: jakarta-tomcat-4.0/catalina/docs/dev classloaders.html

2001-02-20 Thread glenn

glenn   01/02/20 19:38:07

  Modified:catalina/docs/dev classloaders.html
  Log:
  Cleaned up library/class locations
  
  Revision  ChangesPath
  1.4   +13 -12jakarta-tomcat-4.0/catalina/docs/dev/classloaders.html
  
  Index: classloaders.html
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/docs/dev/classloaders.html,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- classloaders.html 2001/02/18 03:33:48 1.3
  +++ classloaders.html 2001/02/21 03:38:06 1.4
  @@ -74,31 +74,32 @@
   licode$CATALINA_HOME/bin/bootstrap.jar/code - The Bootstrap class
   that is used to initialize the Catalina server, and the class
   loader implementation classes it depends on./li
  -licode$CATALINA_HOME/bin/naming.jar/code - The JNDI context
  -implementation that is used by Catalina./li
  -licode$CATALINA_HOME/bin/servlet.jar/code - The servlet and
  -JSP API classes./li
   licode$JAVA_HOME/lib/tools.jar/code - The Javac
   compiler used to compile the servlets generated from JSP pages
   (if present on your system)./li
   /ul
   listrongCommon/strong - This class loader is initialized to include all 
  -JAR files in the code$CATALINA_HOME/bin/code directory, except those
  -attached to the strongSystem/strong class loader:
  +JAR files in the code$CATALINA_HOME/common/lib/code directory and
  +the code$CATALINA_HOME/common/classes/code directory if it exists.
   ul
  -licode$CATALIA_HOME/bin/naming.jar/code - The JNDI implementation
  -used by Tomcat 4, added only if you are running in a JDK 1.2
  -environment (the JNDI classes are included in JDK 1.3 or later)./li
  +licode$CATALINA_HOME/common/lib/servlet.jar/code - The servlet and
  +JSP API classes./li
  +licode$CATALIA_HOME/common/lib/naming.jar/code - The JNDI
  + implementation used by Tomcat 4, added only if you are running
  + in a JDK 1.2 environment (the JNDI classes are included in JDK
  + 1.3 or later)./li
   /ul
   listrongCatalina/strong - This class loader is initialized to include
   all JAR files in the code$CATALINA_HOME/server/code directory, which
   should contain Catalina itself (i.e. all classes whose fully qualified
   names begin with codeorg.apache.catalina./code), and any JAR files
  -that it depends on.  Because these classes are loaded from a separate
  +that it depends on and the code$CATALINA_HOME/common/classes/code
  +directory if it exists.  Because these classes are loaded from a separate
   class loader, which is not visible to the strongWebapp/strong class
   loader, they are emnot/em visible to web applications./li
   listrongShared/strong - This class loader is initialized to include
  -all JAR files in the code$CATALINA_HOME/lib/code directory.  All of
  +all JAR files in the code$CATALINA_HOME/lib/code directory and the
  +code$CATALINA_HOME/common/classes/code directory if it exists.  All of
   the classes in these repositories will be visible to all web applications,
   so they may be used to share information between web apps
   (strongNOTE/strong - this behavior is specific to Tomcat 4.0, and
  @@ -248,7 +249,7 @@
   
   br
   div align="center"hr width="75%"font size="2"
  -$Id: classloaders.html,v 1.3 2001/02/18 03:33:48 craigmcc Exp $
  +$Id: classloaders.html,v 1.4 2001/02/21 03:38:06 glenn Exp $
   /font/div
   
   /body
  
  
  

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




cvs commit: jakarta-tomcat-4.0/catalina/docs/dev classloaders.html

2001-02-22 Thread glenn

glenn   01/02/22 18:32:20

  Modified:catalina/docs/dev classloaders.html
  Log:
  Fix server and shared classes directory location
  
  Revision  ChangesPath
  1.5   +3 -3  jakarta-tomcat-4.0/catalina/docs/dev/classloaders.html
  
  Index: classloaders.html
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/docs/dev/classloaders.html,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- classloaders.html 2001/02/21 03:38:06 1.4
  +++ classloaders.html 2001/02/23 02:32:20 1.5
  @@ -93,13 +93,13 @@
   all JAR files in the code$CATALINA_HOME/server/code directory, which
   should contain Catalina itself (i.e. all classes whose fully qualified
   names begin with codeorg.apache.catalina./code), and any JAR files
  -that it depends on and the code$CATALINA_HOME/common/classes/code
  +that it depends on and the code$CATALINA_HOME/server/classes/code
   directory if it exists.  Because these classes are loaded from a separate
   class loader, which is not visible to the strongWebapp/strong class
   loader, they are emnot/em visible to web applications./li
   listrongShared/strong - This class loader is initialized to include
   all JAR files in the code$CATALINA_HOME/lib/code directory and the
  -code$CATALINA_HOME/common/classes/code directory if it exists.  All of
  +code$CATALINA_HOME/classes/code directory if it exists.  All of
   the classes in these repositories will be visible to all web applications,
   so they may be used to share information between web apps
   (strongNOTE/strong - this behavior is specific to Tomcat 4.0, and
  @@ -249,7 +249,7 @@
   
   br
   div align="center"hr width="75%"font size="2"
  -$Id: classloaders.html,v 1.4 2001/02/21 03:38:06 glenn Exp $
  +$Id: classloaders.html,v 1.5 2001/02/23 02:32:20 glenn Exp $
   /font/div
   
   /body
  
  
  

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




cvs commit: jakarta-tomcat-4.0/jasper build.xml

2001-02-22 Thread glenn

glenn   01/02/22 18:35:08

  Modified:jasper   build.xml
  Log:
  Remove installation of servlet.jar in /bin by jasper build
  
  Revision  ChangesPath
  1.15  +1 -2  jakarta-tomcat-4.0/jasper/build.xml
  
  Index: build.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/jasper/build.xml,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- build.xml 2001/02/18 02:18:14 1.14
  +++ build.xml 2001/02/23 02:35:07 1.15
  @@ -37,8 +37,7 @@
   chmod perm="+x" file="${jasper.build}/bin/jspc.sh"/
   
   !-- Shared Extensions --
  -!--   Jasper needs the servlet API classes --
  -copy file="${servlet.jar}" tofile="${jasper.build}/bin/servlet.jar"/
  +!--   Jasper uses the shared servlet.jar provided by Tomcat --
   !--   Jasper needs JAXP1.1/SAX2.0 compliant parser --
   copy file="${parser.jar}"
tofile="${jasper.build}/lib/${jasper.jaxp.parser.jar}"/
  
  
  

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




cvs commit: jakarta-tomcat-4.0/catalina/docs/dev building.html

2001-02-22 Thread glenn

glenn   01/02/22 19:15:04

  Modified:catalina/docs/dev building.html
  Log:
  Add build docs for JNDI JDBC DataSource
  
  Revision  ChangesPath
  1.3   +15 -1 jakarta-tomcat-4.0/catalina/docs/dev/building.html
  
  Index: building.html
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/docs/dev/building.html,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- building.html 2001/01/14 04:26:11 1.2
  +++ building.html 2001/02/23 03:15:02 1.3
  @@ -41,6 +41,20 @@
   in your own applications), but the codejndi.jar/code file must be available
   on the class path or as a system extension./p
   
  +h3JNDI JDBC DataSource support/h3
  +
  +pIf you want to build in support for JNDI JDBC DataSources you need to
  +download the following packages and put their jar files in your classpath.
  +
  +liTyrex a href="http://tyrex.exolab.org/"http://tyrex.exolab.org//a/li
  +
  +liJava Transaction API (JTA) a href="http://java.sun.com/products/jta"
  +http://java.sun.com/products/jta/a/li
  +
  +liJava JDBC 2.0 Optional Extensions a href="http://java.sun.com/products/jdbc/"
  +http://java.sun.com/products/jdbc//a/li
  +/p
  +
   h3Java API for XML Parsing (JAXP)/h3
   
   pDownload and install the current version of the Java API for XML Parsing
  @@ -187,7 +201,7 @@
   
   br
   div align="center"hr width="75%"font size="2"
  -$Id: building.html,v 1.2 2001/01/14 04:26:11 craigmcc Exp $
  +$Id: building.html,v 1.3 2001/02/23 03:15:02 glenn Exp $
   /font/div
   
   /body
  
  
  

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




cvs commit: jakarta-tomcat-4.0/catalina/docs/config default.html

2001-02-25 Thread glenn

glenn   01/02/25 19:47:38

  Added:   catalina/docs/config default.html
  Log:
  Implement DefaultContext in server.xml config
  
  Revision  ChangesPath
  1.1  jakarta-tomcat-4.0/catalina/docs/config/default.html
  
  Index: default.html
  ===
  html
  head
  titleThe 'DefaultContext' Component/title
  /head
  body bgcolor="white"
  
  div align="center"
  h1The uDefaultContext/u Component/h1
  br
  a href="#Introduction"[Introduction]/a
  a href="#Common Attributes"[Common Attributes]/a
  a href="#Utility Components"[Utility Components]/a
  a href="#Special Features"[Special Features]/a
  /br
  /div
  
  
  a name="Introduction"/a
  h2Introduction/h2
  
  pA strongDefaultContext/strong component represents a subset
  of the a href="context.html"Context/a configuration elements.
  A codeDefaultContext/code can be nested within an
  a href="engine.html"Engine/a or a href="host.html"Host/a./p
  
  pThe elements you configure for a codeDefaultContext/code within
  both the codeEngine/code and codeHost/code elements are
  added to the configuration of any automatically created web application
  context or configured context./p
  
  pIf you wish to configure a codeContext/code which does not use
  the codeDefaultContext/code configuration set the codeContext/code
  attribute codeoverride="true"/code.
  br
  
  a name="Common Attributes"/a
  h2Common Attributes/h2
  
  pAll implementations of the strongContext/strong component support the
  following attributes:/p
  
  table border="1" width="100%"
  
tr
  th width="15%"Attribute/th
  th width="85%"Description/th
/tr
  
tr
  tdcodecookies/code/td
  td
Set to codetrue/code if you want cookies to be used for session
identifier communication (if supported by the client).  Set to
codefalse/code if you want to skip even trying session id cookies,
and rely only on URL rewriting.  If not specified, the default value is
codetrue/code.
  /td
/tr
  
tr
  tdcodecrossContext/code/td
  td
Set to codetrue/code of you want calls from within this application
to codeServletContext.getContext()/code to successfully return the
codeServletContext/code for other web applications running in this
host.  Set to codefalse/code in security conscious environments, so
that codegetContext()/code calls will return codenull/code.  The
default value is codefalse/code.
  /td
/tr
  
tr
  tdcodereloadable/code/td
  td
Set this attribute to codetrue/code if you wish to have Catalina
check the classes in codeWEB-INF/classes/code and
codeWEB-INF/lib/code for modification, and automatically reload
this application if a change is detected.  This feature is very useful
during development; however, it requires significant runtime overhead
so it is not recommended for production deployment scenarios.
  /td
/tr
  
tr
  tdcodewrapperClass/code/td
  td
Java class name of the codeorg.apache.catalina.Wrapper/code
implementation class that will be used for servlets managed by this
Context.  If not specified, the standard value
(codeorg.apache.catalina.core.StandardWrapper/code) will be used.
  /td
/tr
  
tr
  tdcodeuseNaming/code/td
  td  
Set this attribute to codetrue/code if you wish to have Catalina
enable JNDI.  Default is codetrue/code.
  /td 
/tr
  
  /table
  
  br
  
  a name="Utility Components"/a
  h2Utility Components/h2
  
  pYou can attach one or more of the following utility components by nesting
  a corresponding declaration inside your strongHost/strong element.
  /p
  
  ul
lia href="loader.html"Loader/a - Configure a class loader associated
with this strongContext/strong.
lia href="manager.html"Manager/a - Configure a session manager
for the sessions associated with this strongContext/strong./li
lia href="resources.html"Resources/a - Configure access to the static
resources associated with this strongContext/strong/li
  /ul
  
  br
  
  a name="Special Features"/a
  h2Special Features/h2
  
  h3Lifecycle Listeners/h3
  
  pIf you have implemented a Java object that needs to know when this
  strongContext/strong is started or stopped, you can declare it by nesting a
  codelt;Listenergt;/code element inside the codelt;Contextgt;/code
  element.  The class you specify in the codeclassName/code attribute
  of this Listener must implement the
  codeorg.apache.catalina.LifecycleListener/code interface, and it will be
  notified about the occurrence of the corre

cvs commit: jakarta-tomcat-4.0/catalina/docs/config categories.html

2001-02-25 Thread glenn

glenn   01/02/25 19:48:45

  Modified:catalina/docs/config categories.html
  Log:
  Implement DefaultContext in server.xml config
  
  Revision  ChangesPath
  1.3   +1 -0  jakarta-tomcat-4.0/catalina/docs/config/categories.html
  
  Index: categories.html
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/docs/config/categories.html,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- categories.html   2001/01/14 04:17:05 1.2
  +++ categories.html   2001/02/26 03:48:44 1.3
  @@ -30,6 +30,7 @@
   lia target="MAIN" href="engine.html"Engine/a/li
   lia target="MAIN" href="host.html"Host/a/li
   lia target="MAIN" href="context.html"Context/a/li
  +lia target="MAIN" href="default.html"DefaultContext/a/li
   /ul
   
   h3Utilities/h3
  
  
  

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




cvs commit: jakarta-tomcat-4.0/catalina/docs/config context.html

2001-02-25 Thread glenn

glenn   01/02/25 19:48:59

  Modified:catalina/docs/config context.html
  Log:
  Implement DefaultContext in server.xml config
  
  Revision  ChangesPath
  1.3   +19 -6 jakarta-tomcat-4.0/catalina/docs/config/context.html
  
  Index: context.html
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/docs/config/context.html,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- context.html  2001/01/14 04:17:05 1.2
  +++ context.html  2001/02/26 03:48:59 1.3
  @@ -143,6 +143,22 @@
   /td
 /tr
   
  +  tr
  +tdcodeuseNaming/code/td
  +td  
  +  Set this attribute to codetrue/code if you wish to have Catalina
  +  enable JNDI.  Default is codetrue/code.
  +/td 
  +  /tr
  +
  +  tr
  +tdcodeoverride/code/td
  +td  
  +  Set this attribute to codetrue/code if you wish to over ride
  +  the DefaultContext configuration.  Default is codefalse/code.
  +/td
  +  /tr
  +
   /table
   
   br
  @@ -192,11 +208,8 @@
   h2Utility Components/h2
   
   pYou can attach one or more of the following utility components by nesting
  -a corresponding declaration inside your strongHost/strong element.
  -Unless overridden by a utility component of the same name being nested in a
  -a href="context.html"Context/a element,
  -the utility components you declare here will be shared among all 
  -web applications running in this strongHost/strong:/p
  +a corresponding declaration inside your strongContext/strong element.
  +/p
   
   ul
 lia href="loader.html"Loader/a - Configure a class loader associated
  @@ -237,7 +250,7 @@
prefix="myapp_access_log." suffix=".txt"
pattern="common"/gt;
 ...
  -lt;/Hostgt;
  +lt;/Contextgt;
   
   /pre
   
  
  
  

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




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

2001-02-25 Thread glenn

glenn   01/02/25 19:49:45

  Modified:catalina/src/share/org/apache/catalina Engine.java
  Log:
  Implement DefaultContext in server.xml config
  
  Revision  ChangesPath
  1.3   +23 -4 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Engine.java
  
  Index: Engine.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Engine.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Engine.java   2000/12/19 03:23:11 1.2
  +++ Engine.java   2001/02/26 03:49:44 1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Engine.java,v 1.2 
2000/12/19 03:23:11 craigmcc Exp $
  - * $Revision: 1.2 $
  - * $Date: 2000/12/19 03:23:11 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Engine.java,v 1.3 
2001/02/26 03:49:44 glenn Exp $
  + * $Revision: 1.3 $
  + * $Date: 2001/02/26 03:49:44 $
*
* 
*
  @@ -64,6 +64,8 @@
   
   package org.apache.catalina;
   
  +import org.apache.catalina.Context;
  +import org.apache.catalina.core.DefaultContext;
   
   /**
* An bEngine/b is a Container that represents the entire Catalina servlet
  @@ -88,7 +90,7 @@
* should throw codeIllegalArgumentException/code.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.2 $ $Date: 2000/12/19 03:23:11 $
  + * @version $Revision: 1.3 $ $Date: 2001/02/26 03:49:44 $
*/
   
   public interface Engine extends Container {
  @@ -111,7 +113,24 @@
   public void setDefaultHost(String defaultHost);
   
   
  +/**
  + * Set the DefaultContext
  + * for new web applications.
  + *
  + * @param defaultContext The new DefaultContext
  + */
  +public void addDefaultContext(DefaultContext defaultContext);
  +
  +
   // - Public Methods
  +
  +
  +/**
  + * Import the DefaultContext config into a web application context.
  + *
  + * @param context web application context to import default context
  + */
  +public void importDefaultContext(Context context);
   
   
   }
  
  
  

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




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

2001-02-25 Thread glenn

glenn   01/02/25 19:51:10

  Modified:catalina/src/share/org/apache/catalina Host.java
  Log:
  Implement DefaultContext in server.xml config
  
  Revision  ChangesPath
  1.3   +23 -5 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Host.java
  
  Index: Host.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Host.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Host.java 2000/08/12 18:57:28 1.2
  +++ Host.java 2001/02/26 03:51:10 1.3
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Host.java,v 1.2 
2000/08/12 18:57:28 craigmcc Exp $
  - * $Revision: 1.2 $
  - * $Date: 2000/08/12 18:57:28 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Host.java,v 1.3 
2001/02/26 03:51:10 glenn Exp $
  + * $Revision: 1.3 $
  + * $Date: 2001/02/26 03:51:10 $
*
* 
*
  @@ -66,8 +66,9 @@
   
   
   import javax.servlet.ServletContext;
  +import org.apache.catalina.Context;
  +import org.apache.catalina.core.DefaultContext;
   
  -
   /**
* A bHost/b is a Container that represents a virtual host in the
* Catalina servlet engine.  It is useful in the following types of scenarios:
  @@ -90,7 +91,7 @@
* an individual servlet context), depending upon the Engine implementation.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.2 $ $Date: 2000/08/12 18:57:28 $
  + * @version $Revision: 1.3 $ $Date: 2001/02/26 03:51:10 $
*/
   
   public interface Host extends Container {
  @@ -133,6 +134,15 @@
   
   
   /**
  + * Set the DefaultContext
  + * for new web applications.
  + *
  + * @param defaultContext The new DefaultContext
  + */
  +public void addDefaultContext(DefaultContext defaultContext);
  +
  +
  +/**
* Return the canonical, fully qualified, name of the virtual host
* this Container represents.
*/
  @@ -151,6 +161,14 @@
   
   
   // - Public Methods
  +
  +
  +/**
  + * Import the DefaultContext config into a web application context.
  + *
  + * @param context web application context to import default context
  + */
  +public void importDefaultContext(Context context);
   
   
   /**
  
  
  

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




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardContext.java

2001-02-25 Thread glenn

glenn   01/02/25 19:51:36

  Modified:catalina/src/share/org/apache/catalina/core
StandardContext.java
  Log:
  Implement DefaultContext in server.xml config
  
  Revision  ChangesPath
  1.41  +36 -4 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java
  
  Index: StandardContext.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- StandardContext.java  2001/02/22 01:20:24 1.40
  +++ StandardContext.java  2001/02/26 03:51:35 1.41
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
 1.40 2001/02/22 01:20:24 remm Exp $
  - * $Revision: 1.40 $
  - * $Date: 2001/02/22 01:20:24 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
 1.41 2001/02/26 03:51:35 glenn Exp $
  + * $Revision: 1.41 $
  + * $Date: 2001/02/26 03:51:35 $
*
* 
*
  @@ -138,7 +138,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
  - * @version $Revision: 1.40 $ $Date: 2001/02/22 01:20:24 $
  + * @version $Revision: 1.41 $ $Date: 2001/02/26 03:51:35 $
*/
   
   public class StandardContext
  @@ -347,6 +347,12 @@
   
   
   /**
  + * The DefaultContext override flag for this web application.
  + */
  +private boolean override = false;
  +
  +
  +/**
* The resource environment references for this web application,
* keyed by name.
*/
  @@ -843,6 +849,16 @@
   
   
   /**
  + * Return the DefaultContext override flag for this web application.
  + */
  +public boolean getOverride() {
  +
  +return (this.override);
  +
  +}
  +
  +
  +/**
* Set the reloadable flag for this web application.
*
* @param reloadable The new reloadable flag
  @@ -854,6 +870,22 @@
support.firePropertyChange("reloadable",
   new Boolean(oldReloadable),
   new Boolean(this.reloadable));
  +
  +}
  +
  +
  +/**
  + * Set the DefaultContext override flag for this web application.
  + *
  + * @param override The new override flag
  + */
  +public void setOverride(boolean override) {
  +
  +boolean oldOverride = this.override;
  +this.override = override;
  +support.firePropertyChange("override",
  +   new Boolean(oldOverride),
  +   new Boolean(this.override));
   
   }
   
  
  
  

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




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardEngine.java

2001-02-25 Thread glenn

glenn   01/02/25 19:52:00

  Modified:catalina/src/share/org/apache/catalina/core
StandardEngine.java
  Log:
  Implement DefaultContext in server.xml config
  
  Revision  ChangesPath
  1.6   +41 -5 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardEngine.java
  
  Index: StandardEngine.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardEngine.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StandardEngine.java   2001/01/23 02:51:15 1.5
  +++ StandardEngine.java   2001/02/26 03:51:59 1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardEngine.java,v
 1.5 2001/01/23 02:51:15 craigmcc Exp $
  - * $Revision: 1.5 $
  - * $Date: 2001/01/23 02:51:15 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardEngine.java,v
 1.6 2001/02/26 03:51:59 glenn Exp $
  + * $Revision: 1.6 $
  + * $Date: 2001/02/26 03:51:59 $
*
* 
*
  @@ -70,21 +70,22 @@
   import javax.servlet.ServletRequest;
   import javax.servlet.http.HttpServletResponse;
   import org.apache.catalina.Container;
  +import org.apache.catalina.Context;
   import org.apache.catalina.Engine;
   import org.apache.catalina.Globals;
   import org.apache.catalina.Host;
   import org.apache.catalina.LifecycleException;
   import org.apache.catalina.Request;
   import org.apache.catalina.Response;
  +import org.apache.catalina.core.DefaultContext;
   
  -
   /**
* Standard implementation of the bEngine/b interface.  Each
* child container must be a Host implementation to process the specific
* fully qualified host name of that virtual host.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.5 $ $Date: 2001/01/23 02:51:15 $
  + * @version $Revision: 1.6 $ $Date: 2001/02/26 03:51:59 $
*/
   
   public class StandardEngine
  @@ -130,6 +131,12 @@
"org.apache.catalina.core.StandardEngineMapper";
   
   
  +/**
  + * DefaultContext config
  + */
  +private DefaultContext defaultContext;
  +
  +
   // - Properties
   
   
  @@ -158,7 +165,36 @@
   }
   
   
  +/**
  + * Set the DefaultContext
  + * for new web applications.
  + *
  + * @param defaultContext The new DefaultContext
  + */
  +public void addDefaultContext(DefaultContext defaultContext) {
  +
  +DefaultContext oldDefaultContext = this.defaultContext;
  +this.defaultContext = defaultContext;
  +support.firePropertyChange("defaultContext",
  +   oldDefaultContext, this.defaultContext);
  +
  +}
  +
  +
   // - Public Methods
  +
  +
  +/**
  + * Import the DefaultContext config into a web application context.
  + *
  + * @param context web application context to import default context
  + */
  +public void importDefaultContext(Context context) {
  +
  + if( this.defaultContext != null );
  +this.defaultContext.importDefaultContext(context);
  +
  +}
   
   
   /**
  
  
  

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




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardHost.java

2001-02-25 Thread glenn

glenn   01/02/25 19:52:22

  Modified:catalina/src/share/org/apache/catalina/core
StandardHost.java
  Log:
  Implement DefaultContext in server.xml config
  
  Revision  ChangesPath
  1.9   +38 -4 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHost.java
  
  Index: StandardHost.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHost.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- StandardHost.java 2001/01/23 05:05:47 1.8
  +++ StandardHost.java 2001/02/26 03:52:21 1.9
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHost.java,v
 1.8 2001/01/23 05:05:47 remm Exp $
  - * $Revision: 1.8 $
  - * $Date: 2001/01/23 05:05:47 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHost.java,v
 1.9 2001/02/26 03:52:21 glenn Exp $
  + * $Revision: 1.9 $
  + * $Date: 2001/02/26 03:52:21 $
*
* 
*
  @@ -89,6 +89,7 @@
   import org.apache.catalina.LifecycleListener;
   import org.apache.catalina.Request;
   import org.apache.catalina.Response;
  +import org.apache.catalina.core.DefaultContext;
   
   
   /**
  @@ -97,7 +98,7 @@
* requests directed to a particular web application.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.8 $ $Date: 2001/01/23 05:05:47 $
  + * @version $Revision: 1.9 $ $Date: 2001/02/26 03:52:21 $
*/
   
   public class StandardHost
  @@ -179,6 +180,11 @@
   private boolean unpackWARs = true;
   
   
  +/**
  + * DefaultContext config
  + */
  +private DefaultContext defaultContext;
  +
   // - Properties
   
   
  @@ -236,6 +242,22 @@
   
   
   /**
  + * Set the DefaultContext
  + * for new web applications.
  + *
  + * @param defaultContext The new DefaultContext
  + */
  +public void addDefaultContext(DefaultContext defaultContext) {
  +
  +DefaultContext oldDefaultContext = this.defaultContext;
  +this.defaultContext = defaultContext;
  +support.firePropertyChange("defaultContext",
  +   oldDefaultContext, this.defaultContext);
  +
  +}
  +
  +
  +/**
* Return the Java class name of the Context implementation class
* for new web applications.
*/
  @@ -318,6 +340,18 @@
   
   // - Public Methods
   
  +
  +/**
  + * Import the DefaultContext config into a web application context.
  + *
  + * @param context web application context to import default context
  + */
  +public void importDefaultContext(Context context) {
  +
  + if( this.defaultContext != null )
  +this.defaultContext.importDefaultContext(context);
  +
  +}
   
   /**
* Add an alias name that should be mapped to this same Host.
  
  
  

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




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup Catalina.java

2001-02-25 Thread glenn

glenn   01/02/25 19:52:48

  Modified:catalina/src/share/org/apache/catalina/startup Catalina.java
  Log:
  Implement DefaultContext in server.xml config
  
  Revision  ChangesPath
  1.16  +62 -25
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Catalina.java
  
  Index: Catalina.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Catalina.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Catalina.java 2001/02/04 00:51:57 1.15
  +++ Catalina.java 2001/02/26 03:52:47 1.16
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Catalina.java,v
 1.15 2001/02/04 00:51:57 glenn Exp $
  - * $Revision: 1.15 $
  - * $Date: 2001/02/04 00:51:57 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Catalina.java,v
 1.16 2001/02/26 03:52:47 glenn Exp $
  + * $Revision: 1.16 $
  + * $Date: 2001/02/26 03:52:47 $
*
* 
*
  @@ -97,7 +97,7 @@
* /u
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.15 $ $Date: 2001/02/04 00:51:57 $
  + * @version $Revision: 1.16 $ $Date: 2001/02/26 03:52:47 $
*/
   
   public class Catalina {
  @@ -327,6 +327,9 @@
   ("setContainer", "org.apache.catalina.Container"));
   
   createStartMapperContext("Server/Service/Engine/Context", mapper);
  + createStartMapperDefaultContext(
  + "Server/Service/Engine/DefaultContext",
  +mapper);
   
mapper.addRule("Server/Service/Engine/Host", mapper.objectCreate
   ("org.apache.catalina.core.StandardHost",
  @@ -342,6 +345,9 @@
   ("addChild", "org.apache.catalina.Container"));
   
   createStartMapperContext("Server/Service/Engine/Host/Context", mapper);
  +createStartMapperDefaultContext(
  + "Server/Service/Engine/Host/DefaultContext",
  + mapper);
   
mapper.addRule("Server/Service/Engine/Host/Listener",
  mapper.objectCreate
  @@ -441,7 +447,59 @@
"configClass"));
mapper.addRule(prefix + "", mapper.addChild
   ("addChild", "org.apache.catalina.Container"));
  + createContextCommon(prefix, mapper);
  +}
  +
  +
  +/**
  + * Create the mapper rules for a DefaultContext, based on the
  + * specified prefix.
  + *
  + * @param prefix Prefix to rule selectors to be created
  + * @param mapper The mapper we are updating
  + */
  +protected void createStartMapperDefaultContext(String prefix,
  + XmlMapper mapper) {
  +
  +mapper.addRule(prefix + "", mapper.objectCreate
  +   ("org.apache.catalina.core.DefaultContext",
  +"className"));
  +mapper.addRule(prefix + "", mapper.setProperties());
  + mapper.addRule(prefix + "", mapper.addChild
  +   ("addDefaultContext", 
"org.apache.catalina.core.DefaultContext"));
  +mapper.addRule(prefix + "/Logger", mapper.objectCreate
  +   (null, "className"));
  +mapper.addRule(prefix + "/Logger",
  +   mapper.setProperties());
  +mapper.addRule(prefix + "/Logger", mapper.addChild
  +   ("setLogger", "org.apache.catalina.Logger"));
  +
  +mapper.addRule(prefix + "/Realm", mapper.objectCreate
  +   (null, "className"));
  +mapper.addRule(prefix + "/Realm",
  +   mapper.setProperties());
  +mapper.addRule(prefix + "/Realm", mapper.addChild
  +   ("setRealm", "org.apache.catalina.Realm"));
  +
  +mapper.addRule(prefix + "/Valve", mapper.objectCreate
  +   (null, "className"));
  +mapper.addRule(prefix + "/Valve",
  +   mapper.setProperties());
  +mapper.addRule(prefix + "/Valve", mapper.addChild
  +   ("addValve", "org.apache.catalina.Valve"));
  +
  +createContextCommon(prefix, mapper);
  +}
   
  +
  +/**
  + * Create the mapper rules for a Context which are common to both
  + * a Context and a DefaultContext, based on the specified prefix.
  + *
  + * @param

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup ContextConfig.java

2001-02-25 Thread glenn

glenn   01/02/25 19:53:13

  Modified:catalina/src/share/org/apache/catalina/startup
ContextConfig.java
  Log:
  Implement DefaultContext in server.xml config
  
  Revision  ChangesPath
  1.41  +21 -5 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java
  
  Index: ContextConfig.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- ContextConfig.java2001/01/24 19:23:09 1.40
  +++ ContextConfig.java2001/02/26 03:53:12 1.41
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
 1.40 2001/01/24 19:23:09 remm Exp $
  - * $Revision: 1.40 $
  - * $Date: 2001/01/24 19:23:09 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
 1.41 2001/02/26 03:53:12 glenn Exp $
  + * $Revision: 1.41 $
  + * $Date: 2001/02/26 03:53:12 $
*
* 
*
  @@ -89,6 +89,7 @@
   import javax.naming.directory.DirContext;
   import org.apache.naming.resources.DirContextURLStreamHandler;
   import org.apache.catalina.Authenticator;
  +import org.apache.catalina.Container;
   import org.apache.catalina.Context;
   import org.apache.catalina.Globals;
   import org.apache.catalina.Lifecycle;
  @@ -99,7 +100,10 @@
   import org.apache.catalina.Valve;
   import org.apache.catalina.Wrapper;
   import org.apache.catalina.core.ContainerBase;
  -import org.apache.catalina.deploy.ErrorPage;
  +import org.apache.catalina.Engine;
  +import org.apache.catalina.Host;
  +import org.apache.catalina.core.DefaultContext;
  +import org.apache.catalina.core.StandardContext;
   import org.apache.catalina.deploy.LoginConfig;
   import org.apache.catalina.deploy.SecurityConstraint;
   import org.apache.catalina.loader.Extension;
  @@ -116,7 +120,7 @@
* of that Context, and the associated defined servlets.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.40 $ $Date: 2001/01/24 19:23:09 $
  + * @version $Revision: 1.41 $ $Date: 2001/02/26 03:53:12 $
*/
   
   public final class ContextConfig
  @@ -771,6 +775,18 @@
if (debug  0)
log(sm.getString("contextConfig.start"));
   ok = true;
  +
  + // Set properties based on DefaultContext
  + Container container = context.getParent();
  + if( !context.getOverride() ) {
  + if( container instanceof Host ) {
  + ((Host)container).importDefaultContext(context);
  + container = container.getParent();
  + }
  + if( container instanceof Engine ) {
  + ((Engine)container).importDefaultContext(context);
  + }
  + }
   
// Process the default and application web.xml files
XmlMapper mapper = createWebMapper();
  
  
  

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




cvs commit: jakarta-tomcat-4.0/catalina/src/conf catalina.policy

2001-02-26 Thread glenn

glenn   01/02/26 19:18:15

  Modified:catalina/src/conf catalina.policy
  Log:
  Update policy for new lib/class file locations
  
  Revision  ChangesPath
  1.5   +15 -10jakarta-tomcat-4.0/catalina/src/conf/catalina.policy
  
  Index: catalina.policy
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/conf/catalina.policy,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- catalina.policy   2001/02/18 17:18:40 1.4
  +++ catalina.policy   2001/02/27 03:18:15 1.5
  @@ -8,7 +8,7 @@
   //
   // * Read access to the document root directory
   //
  -// $Id: catalina.policy,v 1.4 2001/02/18 17:18:40 glenn Exp $
  +// $Id: catalina.policy,v 1.5 2001/02/27 03:18:15 glenn Exp $
   // 
   
   
  @@ -29,20 +29,18 @@
   // == CATALINA CODE PERMISSIONS ===
   
   
  -// These permissions apply to the server startup code, and the servlet API
  -// classes that are shared across all class loaders
  +// These permissions apply to the server startup code
   grant codeBase "file:${catalina.home}/bin/bootstrap.jar" {
   permission java.security.AllPermission;
   };
   
  -grant codeBase "file:${catalina.home}/bin/servlet.jar" {
  +// These permissions apply to the servlet API classes
  +// and those that are shared across all class loaders
  +// located in the "common" directory
  +grant codeBase "file:${catalina.home}/common/-" {
   permission java.security.AllPermission;
   };
   
  -grant codeBase "file:${catalina.home}/bin/naming.jar" {
  -permission java.security.AllPermission;
  -};
  -
   // These permissions apply to the container's core code, plus any additional
   // libraries installed in the "server" directory
   grant codeBase "file:${catalina.home}/server/-" {
  @@ -50,16 +48,22 @@
   };
   
   // These permissions apply to the jasper page compiler
  +// located in the "jasper" directory.
   grant codeBase "file:${catalina.home}/jasper/-" {
   permission java.security.AllPermission;
   };
   
  -// These permissions apply to all extension libraries (including Jasper,
  -// if present) installed in the "lib" directory
  +// These permissions apply to shared web application libraries
  +// including the Jasper runtime library installed in the "lib" directory
   grant codeBase "file:${catalina.home}/lib/-" {
   permission java.security.AllPermission;
   };
   
  +// These permissions apply to shared web application classes
  +// located in the "classes" directory
  +grant codeBase "file:${catalina.home}/classes/-" {
  +permission java.security.AllPermission;
  +};
   
   // == WEB APPLICATION PERMISSIONS =
   
  @@ -90,6 +94,7 @@
permission java.util.PropertyPermission "java.vm.vendor", "read";
permission java.util.PropertyPermission "java.vm.name", "read";
permission java.io.FilePermission "jndi:/WEB-INF/-", "read";
  + permission java.io.FilePermission "jar:jndi:/WEB-INF/lib/-", "read";
   };
   
   
  
  
  

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




cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet JspServlet.java

2001-02-28 Thread glenn

glenn   01/02/28 14:05:52

  Modified:jasper/src/share/org/apache/jasper/servlet JspServlet.java
  Log:
  Fix preload of a jasper JspServlet inner class
  
  Revision  ChangesPath
  1.14  +2 -2  
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet/JspServlet.java
  
  Index: JspServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet/JspServlet.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- JspServlet.java   2001/02/19 01:14:23 1.13
  +++ JspServlet.java   2001/02/28 22:05:52 1.14
  @@ -323,9 +323,9 @@
   parentClassLoader.loadClass( basePackage +
   "runtime.JspRuntimeLibrary$PrivilegedIntrospectHelper");
   parentClassLoader.loadClass( basePackage +
  -"servlet.JspServlet$JspServletWrapper");
  -parentClassLoader.loadClass( basePackage +
"runtime.ServletResponseWrapperInclude");
  + this.getClass().getClassLoader().loadClass( basePackage +
  +"servlet.JspServlet$JspServletWrapper");
} catch (ClassNotFoundException ex) {
System.out.println(
"Jasper JspServlet preload of class failed: " +
  
  
  

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




cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup Bootstrap.java

2001-03-05 Thread glenn

glenn   01/03/05 17:42:55

  Modified:catalina/src/share/org/apache/catalina/startup
Bootstrap.java
  Log:
  Add classes directory URL as last URL for ClassLoaders
  
  Revision  ChangesPath
  1.13  +58 -58
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Bootstrap.java
  
  Index: Bootstrap.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Bootstrap.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Bootstrap.java2001/02/21 03:38:47 1.12
  +++ Bootstrap.java2001/03/06 01:42:55 1.13
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Bootstrap.java,v
 1.12 2001/02/21 03:38:47 glenn Exp $
  - * $Revision: 1.12 $
  - * $Date: 2001/02/21 03:38:47 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Bootstrap.java,v
 1.13 2001/03/06 01:42:55 glenn Exp $
  + * $Revision: 1.13 $
  + * $Date: 2001/03/06 01:42:55 $
*
* 
*
  @@ -85,7 +85,7 @@
* class path and therefore not visible to application level classes.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.12 $ $Date: 2001/02/21 03:38:47 $
  + * @version $Revision: 1.13 $ $Date: 2001/03/06 01:42:55 $
*/
   
   public final class Bootstrap {
  @@ -207,24 +207,6 @@
   // Construct the "class path" for this class loader
   ArrayList list = new ArrayList();
   
  -File classes = new File(System.getProperty("catalina.home"),
  -"common/classes");
  -if (classes.exists()  classes.canRead() 
  -classes.isDirectory()) {
  -try {
  -URL url = new URL("file", null,
  -  classes.getCanonicalPath() + "/");
  -if (debug = 1) 
  -log("  Adding " + url.toString());
  -list.add(url.toString());
  -} catch (IOException e) {   
  -System.out.println("Cannot create URL for " +
  -   classes.getAbsolutePath());
  -e.printStackTrace(System.out);
  -System.exit(1); 
  -}
  -}
  -
   File directory = new File(System.getProperty("catalina.home"),
 "common/lib");
   if (!directory.exists() || !directory.canRead() ||
  @@ -254,6 +236,24 @@
   }
   }
   
  +File classes = new File(System.getProperty("catalina.home"),
  +"common/classes");
  +if (classes.exists()  classes.canRead() 
  +classes.isDirectory()) {
  +try {
  +URL url = new URL("file", null,
  +  classes.getCanonicalPath() + "/");
  +if (debug = 1)
  +log("  Adding " + url.toString());
  +list.add(url.toString());
  +} catch (IOException e) {
  +System.out.println("Cannot create URL for " +
  +   classes.getAbsolutePath());
  +e.printStackTrace(System.out);
  +System.exit(1);
  +}
  +}
  +
   // Construct the class loader itself
   String array[] = (String[]) list.toArray(new String[list.size()]);
   StandardClassLoader loader = new StandardClassLoader(array);
  @@ -275,24 +275,6 @@
   // Construct the "class path" for this class loader
   ArrayList list = new ArrayList();
   
  -File classes = new File(System.getProperty("catalina.home"),
  -"server/classes");
  -if (classes.exists()  classes.canRead() 
  -classes.isDirectory()) {
  -try {
  -URL url = new URL("file", null,
  -  classes.getCanonicalPath() + "/");
  -if (debug = 1)
  -log("  Adding " + url.toString());
  -list.add(url.toString());
  -} catch (IOException e) {
  -System.out.println("Cannot create URL for " +
  -   classes.getAbsolutePath());
  -e.printStackTrace(System.out);
  -System.exit(1);
  -}
  -}
  -
   File directory = new File(System.getProperty("catalina.home"),
  

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader StandardClassLoader.java

2001-03-05 Thread glenn

glenn   01/03/05 17:43:47

  Modified:catalina/src/share/org/apache/catalina/loader
StandardClassLoader.java
  Log:
  Catch SecurityManager FilePermission AccessControlException
  
  Revision  ChangesPath
  1.12  +22 -13
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.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- StandardClassLoader.java  2001/02/18 02:18:13 1.11
  +++ StandardClassLoader.java  2001/03/06 01:43:46 1.12
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardClassLoader.java,v
 1.11 2001/02/18 02:18:13 craigmcc Exp $
  - * $Revision: 1.11 $
  - * $Date: 2001/02/18 02:18:13 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/loader/StandardClassLoader.java,v
 1.12 2001/03/06 01:43:46 glenn Exp $
  + * $Revision: 1.12 $
  + * $Date: 2001/03/06 01:43:46 $
*
* 
*
  @@ -75,6 +75,7 @@
   import java.net.URLConnection;
   import java.net.URLStreamHandlerFactory;
   import java.net.URLStreamHandler;
  +import java.security.AccessControlException;
   import java.security.CodeSource;
   import java.security.PermissionCollection;
   import java.security.Policy;
  @@ -109,7 +110,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
  - * @version $Revision: 1.11 $ $Date: 2001/02/18 02:18:13 $
  + * @version $Revision: 1.12 $ $Date: 2001/03/06 01:43:46 $
*/
   
   public class StandardClassLoader
  @@ -643,6 +644,8 @@
log("  super.findClass(" + name + ")");
try {
clazz = super.findClass(name);
  +} catch(AccessControlException ace) {
  + throw new ClassNotFoundException(name);
} catch (RuntimeException e) {
if (debug = 4)
log("  --RuntimeException Rethrown", e);
  @@ -673,15 +676,21 @@
   pathname = pathname.substring(5);
   pathname += File.separatorChar +
   name.replace('.', File.separatorChar) + ".class";
  -File file = new File(pathname);
  -if (file.exists()  file.canRead()) {
  -if (debug = 3)
  -log("Caching from '" + file.getAbsolutePath() +
  -"' modified '" +
  -(new java.sql.Timestamp(file.lastModified())) + "'");
  -classCache.put(name, new ClassCacheEntry(clazz, file,
  - file.lastModified()));
  -}
  + try {
  +File file = new File(pathname);
  +if (file.exists()  file.canRead()) {
  +if (debug = 3)
  +log("Caching from '" + file.getAbsolutePath() +
  +"' modified '" +
  +(new java.sql.Timestamp(file.lastModified())) +
  + "'");
  +classCache.put(name, new ClassCacheEntry(clazz, file,
  +   file.lastModified()));
  + }
  +} catch(AccessControlException ace) {
  + // Don't worry about caching the class last modified
  + // if ClassLoader doesn't have permission to read file
  + }
   }
   
   // Return the class we have located
  
  
  

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




cvs commit: jakarta-tomcat-4.0/catalina/src/bin catalina.sh

2001-03-06 Thread glenn

glenn   01/03/06 06:13:51

  Modified:catalina/src/bin catalina.sh
  Log:
  Fix embedded startup classpath, contributed by Ulf Jaehrig
  
  Revision  ChangesPath
  1.14  +5 -2  jakarta-tomcat-4.0/catalina/src/bin/catalina.sh
  
  Index: catalina.sh
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/bin/catalina.sh,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- catalina.sh   2001/02/21 03:38:27 1.13
  +++ catalina.sh   2001/03/06 14:13:49 1.14
  @@ -12,7 +12,7 @@
   #
   #   JAVA_HOME Must point at your Java Development Kit installation.
   #
  -# $Id: catalina.sh,v 1.13 2001/02/21 03:38:27 glenn Exp $
  +# $Id: catalina.sh,v 1.14 2001/03/06 14:13:49 glenn Exp $
   # -
   
   
  @@ -93,7 +93,10 @@
   elif [ "$1" = "embedded" ] ; then
   
 shift
  -  for i in ${CATALINA_HOME}/server/*.jar ; do
  +  for i in ${CATALINA_HOME}/server/lib/*.jar ; do
  +CP=$i:${CP}
  +  done
  +  for i in ${CATALINA_HOME}/common/lib/*.jar ; do
   CP=$i:${CP}
 done
 echo Embedded Classpath: $CP
  
  
  

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




cvs commit: jakarta-tomcat-4.0/catalina build.xml

2001-03-11 Thread glenn

glenn   01/03/11 07:05:46

  Modified:catalina build.xml
  Log:
  Added conditional build of SendMailFactory based on presence of javamail
  
  Revision  ChangesPath
  1.32  +5 -1  jakarta-tomcat-4.0/catalina/build.xml
  
  Index: build.xml
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/build.xml,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- build.xml 2001/02/21 03:37:45 1.31
  +++ build.xml 2001/03/11 15:05:46 1.32
  @@ -89,7 +89,7 @@
 target name="build-main" depends="build-static"
   
   
  -!-- === Conditional Compilation Falgs  --
  +!-- === Conditional Compilation Flags  --
   available property="tyrex.present"
classname="tyrex.jdbc.xa.EnabledDataSource" /
   available property="jdbcse.present"
  @@ -98,6 +98,8 @@
classname="javax.transaction.UserTransaction" /
   available property="avalon.present" 
classname="org.apache.avalon.blocks.Block" /
  +available property="javamail.present"
  + classname="javax.mail.internet.MimeMessage" /
   
   !-- Compile internal server components --
   javac   srcdir="src/share" destdir="${catalina.build}/classes"
  @@ -110,6 +112,8 @@
  unless="jdbcse.present" /
 exclude name="**/factory/TransactionFactory.java" 
  unless="jta.present" /
  +  exclude name="**/factory/SendMailFactory.java"
  +   unless="javamail.present" /
 exclude name="**/startup/CatalinaBlock.java" 
  unless="avalon.present" /
   /javac
  
  
  

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




cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper JspEngineContext.java

2001-03-21 Thread glenn

glenn   01/03/21 04:37:29

  Modified:jasper/src/share/org/apache/jasper JspEngineContext.java
  Log:
  The classpath needed by javac is now built dynamically by using getURLs
  on the Context URLClassLoader and all its parent class loaders except
  for the system class loader.  This removes the need to pass a context
  attribute for the classpath between Tomcat and Jasper.
  
  This also fixed a problem with a bad class path element due to
  Jasper not understanding jndi named URL's.
  
  Revision  ChangesPath
  1.6   +33 -6 
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspEngineContext.java
  
  Index: JspEngineContext.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspEngineContext.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JspEngineContext.java 2001/02/08 13:37:27 1.5
  +++ JspEngineContext.java 2001/03/21 12:37:20 1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspEngineContext.java,v
 1.5 2001/02/08 13:37:27 glenn Exp $
  - * $Revision: 1.5 $
  - * $Date: 2001/02/08 13:37:27 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspEngineContext.java,v
 1.6 2001/03/21 12:37:20 glenn Exp $
  + * $Revision: 1.6 $
  + * $Date: 2001/03/21 12:37:20 $
*
* 
* 
  @@ -145,17 +145,44 @@
   
   /**
* The classpath that is passed off to the Java compiler. 
  + *
  + * Uses the URLClassLoader getURLs to build the classpath
  + * for the Context ClassLoader and all parent
  + * ClassLoader's except for the system class loader.
*/
   public String getClassPath() {
  +StringBuffer cpath = new StringBuffer();
  + ClassLoader cl = loader;
  + while( cl != null  cl.getParent() != null ) {
  + if( (cl instanceof URLClassLoader) ) {
  + cpath.append(getClassLoaderPaths((URLClassLoader)cl));
  + }
  + cl = cl.getParent();
  + }
  +return cpath.toString() + classpath;
  +}
  +
  +/**
  + * The classpaths for a URLClassLoader
  + */
  +private String getClassLoaderPaths(URLClassLoader loader) {
URL [] urls = loader.getURLs();
   StringBuffer cpath = new StringBuffer();
   String sep = System.getProperty("path.separator");
   
   for(int i = 0; i  urls.length; i++) {
  -cpath.append((String)urls[i].getFile()+sep);
  + String file = null;
  + String url = urls[i].toString();
  + if( url.startsWith("jndi:") ) {
  + file = getRealPath(url.substring(5));
  + } else if( url.startsWith("jar:jndi:") ) {
  + file = getRealPath(url.substring(9,url.length()-2));
  + } else {
  + file = (String)urls[i].getFile();
  + }
  +cpath.append(file + sep);
   }
  - 
  -return cpath.toString() + classpath;
  +return cpath.toString();
   }
   
   /**
  
  
  



cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet JspServlet.java

2001-03-21 Thread glenn

glenn   01/03/21 04:38:03

  Modified:jasper/src/share/org/apache/jasper/servlet JspServlet.java
  Log:
  The classpath needed by javac is now built dynamically by using getURLs
  on the Context URLClassLoader and all its parent class loaders except
  for the system class loader.  This removes the need to pass a context
  attribute for the classpath between Tomcat and Jasper.
  
  This also fixed a problem with a bad class path element due to
  Jasper not understanding jndi named URL's.
  
  Revision  ChangesPath
  1.15  +4 -21 
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet/JspServlet.java
  
  Index: JspServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet/JspServlet.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- JspServlet.java   2001/02/28 22:05:52 1.14
  +++ JspServlet.java   2001/03/21 12:37:55 1.15
  @@ -150,27 +150,10 @@
private void loadIfNecessary(HttpServletRequest req, HttpServletResponse res) 
   throws JasperException, ServletException, FileNotFoundException 
   {
  -// First try context attribute; if that fails then use the 
  -// classpath init parameter. 
  -
  -// Should I try to concatenate them if both are non-null?
  -
  -String cp = (String) context.getAttribute(Constants.SERVLET_CLASSPATH);
  -
  -String accordingto;
  -
  -if (cp == null || cp.equals("")) {
  -accordingto = "according to the init parameter";
  -cp = options.getClassPath();
  -} else 
  -accordingto = "according to the Servlet Engine";
  -
  -Constants.message("jsp.message.cp_is", 
  -  new Object[] { 
  -  accordingto,
  -  cp == null ? "" : cp
  -  }, 
  -  Logger.INFORMATION);
  + // Get the classpath init parameter
  +String cp = options.getClassPath();
  + if( cp == null )
  + cp = "";
   
   if (loadJSP(jspUri, cp, isErrorPage, req, res) 
   || theServlet == null) {
  
  
  



cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper JspEngineContext.java

2001-03-22 Thread glenn

glenn   01/03/22 08:39:28

  Modified:jasper/src/share/org/apache/jasper JspEngineContext.java
  Log:
  Bug fix for bad class path's generated from non file: URL's
  
  Revision  ChangesPath
  1.8   +10 -4 
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspEngineContext.java
  
  Index: JspEngineContext.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspEngineContext.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JspEngineContext.java 2001/03/21 20:49:10 1.7
  +++ JspEngineContext.java 2001/03/22 16:39:27 1.8
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspEngineContext.java,v
 1.7 2001/03/21 20:49:10 craigmcc Exp $
  - * $Revision: 1.7 $
  - * $Date: 2001/03/21 20:49:10 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/JspEngineContext.java,v
 1.8 2001/03/22 16:39:27 glenn Exp $
  + * $Revision: 1.8 $
  + * $Date: 2001/03/22 16:39:27 $
*
* 
* 
  @@ -152,7 +152,13 @@
   String sep = System.getProperty("path.separator");
   
   for(int i = 0; i  urls.length; i++) {
  -cpath.append((String)urls[i].getFile()+sep);
  + // Tomcat 4 can use URL's other than file URL's,
  + // a protocol other than file: will generate a
  + // bad file system path, so only add file:
  + // protocol URL's to the classpath.
  + if( urls[i].getProtocol().equals("file") ) {
  +cpath.append((String)urls[i].getFile()+sep);
  + }
   }

   return cpath.toString() + classpath;
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/docs manager.html

2001-03-25 Thread glenn

glenn   01/03/25 19:21:57

  Modified:catalina/docs manager.html
  Log:
  Improve webapp unpack WAR file behaviour and enhance manager servlet
  
  Revision  ChangesPath
  1.3   +33 -24jakarta-tomcat-4.0/catalina/docs/manager.html
  
  Index: manager.html
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/docs/manager.html,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- manager.html  2001/01/14 01:31:44 1.2
  +++ manager.html  2001/03/26 03:21:56 1.3
  @@ -19,13 +19,15 @@
   h3Introduction/h3
   
   pTomcat ships with a web application (by default installed at context
  -path code/manager/code) that facilitates deploying, undeploying, and
  -reloading (that is, forcing a reload of all class files without removing the
  -application from service) of other applications that are running in the same
  -virtual host as the Manager application itself.  This application is suited
  -to scripted operation, because it can be executed from any client program that
  -can issue HTTP requests.  As such, it is complementary to other administrative
  -applications that have a more human-oriented user interface./p
  +path code/manager/code) that facilitates installing, starting, stopping,
  +removing, listing information, and reloading (that is, forcing a reload of
  +all class files without removing the application from service) of other web
  +applications that are running in the same virtual host as the Manager
  +application itself.
  +This application is suited to scripted operation, because it can be executed
  +from any client program that can issue HTTP requests.  As such, it is
  +complementary to other administrative applications that have a more
  +human-oriented user interface./p
   
   pstrongWARNING/strong - As of the Tomcat 4.0 milestone 2 release, there
   is a bug in the operation of the "deploy" command that prevents deploying,
  @@ -43,27 +45,36 @@
   have installed the Manager application on context path code/manager/code
   on your local host installation of Tomcat./p
   ul
  -libhttp://localhost:8080/manager/list/b - List the context paths of all
  -web applications currently deployed on the virtual host in which this
  -manager application is deployed./li
  -libhttp://localhost:8080/manager/deploy?path=/xxxamp;war=yyy/b -
  -Deploy the web application whose WAR file (or directory containing the
  +libhttp://localhost:8080/manager/install?path=/xxxamp;war=yyy/b -
  +Install the web application whose WAR file (or directory containing the
   unpacked application) is present at URL codeyyy/code, and attach it
   to context path code/xxx/code.  See below for valid syntax options
   for the web applcation archive URl.  If the URL of an actual WAR file
   is specified, the WAR will be automatically expanded into a directory
   underneath the application base for this virtual host./li
  +libhttp://localhost:8080/manager/list/b - List the context paths
  +of all currently installed web applications for this virtual host.
  +Each context will be listed with the following format
  +codepath:status:sessions/code.  Where path is the context
  +path. Status is either running or stopped. Sessions is the number of
  +active Sessions./li
   libhttp://localhost:8080/manager/reload?path=/xxx/b - Cause the web
  -application deployed at context path code/xxx/code to reload all its
  +application installed at context path code/xxx/code to reload all its
   associated Java classes, even if automatic reloading is disabled./li
  -libhttp://localhost:8080/manager/undeploy?path=/xxx/b - Cause the web
  -application deployed at context path code/xxx/code to be gracefully
  -shut down and undeployed.  If a WAR file was automatically expanded into
  -an unpacked directory when this application was deployed (or when the
  -servlet container was first started), the expanded directory is deleted.
  -/li
  +libhttp://localhost:8080/manager/remove?path=/xxx/b - Cause the web
  +application installed at context path code/xxx/code to be gracefully
  +shutdown and delete the web application directory and files./li
  +libhttp://localhost:8080/manager/sessions?path=/xxx/b - List session
  +information about the web application attached to context path
  +code/xxx/code for this virtual host./li
  +libhttp://localhost:8080/manager/start?path=/xxx/b - Start the web
  +application attached to context path code/xxx/code for this
  +virtual host./li
  +libhttp://localhost:8080/manager/stop?path=/xxx/b - Stop the web
  +application attached to context path code/xxx/code for this
  +virtual host./li
   /ul
  -
  +pUse codepath=//code for the ROOT context./p
   pThe syntax of the URL for a web application archive must conform to one
   of the following patterns to be successfull

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

2001-03-25 Thread glenn

glenn   01/03/25 19:22:14

  Modified:catalina/src/share/org/apache/catalina Deployer.java
  Log:
  Improve webapp unpack WAR file behaviour and enhance manager servlet
  
  Revision  ChangesPath
  1.2   +55 -23
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Deployer.java
  
  Index: Deployer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Deployer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Deployer.java 2000/10/04 23:03:03 1.1
  +++ Deployer.java 2001/03/26 03:22:14 1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Deployer.java,v 
1.1 2000/10/04 23:03:03 craigmcc Exp $
  - * $Revision: 1.1 $
  - * $Date: 2000/10/04 23:03:03 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/Deployer.java,v 
1.2 2001/03/26 03:22:14 glenn Exp $
  + * $Revision: 1.2 $
  + * $Date: 2001/03/26 03:22:14 $
*
* 
*
  @@ -76,7 +76,7 @@
* for each web application will be the context path to which it is attached.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2000/10/04 23:03:03 $
  + * @version $Revision: 1.2 $ $Date: 2001/03/26 03:22:14 $
*/
   
   public interface Deployer extends Container {
  @@ -87,46 +87,46 @@
   
   /**
* The ContainerEvent event type sent when a new application is
  - * deployed by codedeploy()/code.
  + * installed by codeinstall()/code.
*/
  -public static final String DEPLOY_EVENT = "deploy";
  +public static final String INSTALL_EVENT = "install";
   
   
   /**
* The ContainerEvent event type sent when an existing application is
  - * undeployed by codeundeploy()/code.
  + * removed by coderemove()/code.
*/
  -public static final String UNDEPLOY_EVENT = "undeploy";
  +public static final String REMOVE_EVENT = "remove";
   
   
   // - Public Methods
   
   
   /**
  - * Deploy a new web application, whose web application archive is at the
  + * Install a new web application, whose web application archive is at the
* specified URL, into this container with the specified context path.
* A context path of "" (the empty string) should be used for the root
* application for this container.  Otherwise, the context path must
* start with a slash.
* p
  - * If this application is successfully deployed, a ContainerEvent of type
  - * codeDEPLOY_EVENT/code will be sent to all registered listeners,
  + * If this application is successfully installed, a ContainerEvent of type
  + * codeINSTALL_EVENT/code will be sent to all registered listeners,
* with the newly created codeContext/code as an argument.
*
* @param contextPath The context path to which this application should
  - *  be deployed (must be unique)
  + *  be installed (must be unique)
* @param war A URL of type "jar:" that points to a WAR file, or type
*  "file:" that points to an unpacked directory structure containing
  - *  the web application to be deployed
  + *  the web application to be installed
*
* @exception IllegalArgumentException if the specified context path
*  is malformed (it must be "" or start with a slash)
* @exception IllegalArgumentException if the specified context path
*  is already attached to an existing web application
* @exception IOException if an input/output error was encountered
  - *  during deployment
  + *  during installation
*/
  -public void deploy(String contextPath, URL war) throws IOException;
  +public void install(String contextPath, URL war) throws IOException;
   
   
   /**
  @@ -148,22 +148,54 @@
   
   
   /**
  - * Undeploy an existing web application, attached to the specified context
  - * path.  If this application is successfully undeployed, a
  - * ContainerEvent of type codeUNDEPLOY_EVENT/code will be sent to all
  - * registered listeners, with the undeployed codeContext/code as
  + * Remove an existing web application, attached to the specified context
  + * path.  If this application is successfully removed, a
  + * ContainerEvent of type codeREMOVE_EVENT/code will be sent to all
  + * registered listeners, with the removed codeContext/code as
* an argument.
*
  - * @param contextPath The context path of the application to be undeployed
  + * @param contextPath The context path of the application to be removed
 

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core LocalStrings.properties

2001-03-25 Thread glenn

glenn   01/03/25 19:22:35

  Modified:catalina/src/share/org/apache/catalina/core
LocalStrings.properties
  Log:
  Improve webapp unpack WAR file behaviour and enhance manager servlet
  
  Revision  ChangesPath
  1.25  +6 -4  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/LocalStrings.properties,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- LocalStrings.properties   2001/03/18 05:32:12 1.24
  +++ LocalStrings.properties   2001/03/26 03:22:35 1.25
  @@ -77,8 +77,8 @@
   standardHost.accessBase=Cannot access document base directory {0}
   standardHost.alreadyStarted=Host has already been started
   standardHost.appBase=Application base directory {0} does not exist
  -standardHost.deploying=Deploying web application at context path {0} from URL {1}
  -standardHost.deployError=Error deploying application at context path {0}
  +standardHost.installing=Installing web application at context path {0} from URL {1}
  +standardHost.installError=Error deploying application at context path {0}
   standardHost.docBase=Document base directory {0} already exists
   standardHost.mappingError=MAPPING configuration error for request URI {0}
   standardHost.noContext=No Context configured to process this request
  @@ -90,8 +90,10 @@
   standardHost.pathMissing=Context path {0} is not currently in use
   standardHost.pathRequired=Context path is required
   standardHost.pathUsed=Context path {0} is already in use
  -standardHost.undeploying=Undeploying web application at context path {0}
  -standardHost.undeployError=Error undeploying application at context path {0}
  +standardHost.removing=Removing web application at context path {0}
  +standardHost.removeError=Error removing application at context path {0}
  +standardHost.start=Starting web application at context path {0}
  +standardHost.stop=Stopping web application at context path {0}
   standardHost.unfoundContext=Cannot find context for request URI {0}
   standardHost.warRequired=URL to web application archive is required
   standardHost.warURL=Invalid URL for web application archive: {0}
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardHost.java

2001-03-25 Thread glenn

glenn   01/03/25 19:22:57

  Modified:catalina/src/share/org/apache/catalina/core
StandardHost.java
  Log:
  Improve webapp unpack WAR file behaviour and enhance manager servlet
  
  Revision  ChangesPath
  1.10  +127 -54   
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHost.java
  
  Index: StandardHost.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHost.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- StandardHost.java 2001/02/26 03:52:21 1.9
  +++ StandardHost.java 2001/03/26 03:22:57 1.10
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHost.java,v
 1.9 2001/02/26 03:52:21 glenn Exp $
  - * $Revision: 1.9 $
  - * $Date: 2001/02/26 03:52:21 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHost.java,v
 1.10 2001/03/26 03:22:57 glenn Exp $
  + * $Revision: 1.10 $
  + * $Date: 2001/03/26 03:22:57 $
*
* 
*
  @@ -83,9 +83,11 @@
   import org.apache.catalina.Container;
   import org.apache.catalina.Context;
   import org.apache.catalina.Deployer;
  +import org.apache.catalina.Globals;
   import org.apache.catalina.HttpRequest;
   import org.apache.catalina.Host;
   import org.apache.catalina.Lifecycle;
  +import org.apache.catalina.LifecycleException;
   import org.apache.catalina.LifecycleListener;
   import org.apache.catalina.Request;
   import org.apache.catalina.Response;
  @@ -98,7 +100,7 @@
* requests directed to a particular web application.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.9 $ $Date: 2001/02/26 03:52:21 $
  + * @version $Revision: 1.10 $ $Date: 2001/03/26 03:22:57 $
*/
   
   public class StandardHost
  @@ -152,15 +154,6 @@
   
   
   /**
  - * The set of absolute pathnames to directories that were expanded
  - * from WAR files, keyed by context path.  These entries may be used
  - * to indicate that the expanded directory is to be removed when the
  - * application is undeployed.
  - */
  -private HashMap expanded = new HashMap();
  -
  -
  -/**
* The descriptive information string for this implementation.
*/
   private static final String info =
  @@ -185,6 +178,7 @@
*/
   private DefaultContext defaultContext;
   
  +
   // - Properties
   
   
  @@ -528,30 +522,30 @@
   
   
   /**
  - * Deploy a new web application, whose web application archive is at the
  + * Install a new web application, whose web application archive is at the
* specified URL, into this container with the specified context path.
* A context path of "" (the empty string) should be used for the root
* application for this container.  Otherwise, the context path must
* start with a slash.
* p
  - * If this application is successfully deployed, a ContainerEvent of type
  - * codeDEPLOY_EVENT/code will be sent to all registered listeners,
  + * If this application is successfully installed, a ContainerEvent of type
  + * codeINSTALL_EVENT/code will be sent to all registered listeners,
* with the newly created codeContext/code as an argument.
*
* @param contextPath The context path to which this application should
  - *  be deployed (must be unique)
  + *  be installed (must be unique)
* @param war A URL of type "jar:" that points to a WAR file, or type
*  "file:" that points to an unpacked directory structure containing
  - *  the web application to be deployed
  + *  the web application to be installed
*
* @exception IllegalArgumentException if the specified context path
*  is malformed (it must be "" or start with a slash)
* @exception IllegalArgumentException if the specified context path
*  is already attached to an existing web application
* @exception IOException if an input/output error was encountered
  - *  during deployment
  + *  during install
*/
  -public void deploy(String contextPath, URL war) throws IOException {
  +public void install(String contextPath, URL war) throws IOException {
   
   // Validate the format and state of our arguments
   if (contextPath == null)
  @@ -570,7 +564,7 @@
   // Prepare the local variables we will require
   String url = war.toString();
   String docBase = null;
  -log(sm.getString("standardHost.deploying", contextPath, url));
  +log(sm.getString("standardHost.installing"

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets LocalStrings.properties

2001-03-25 Thread glenn

glenn   01/03/25 19:23:20

  Modified:catalina/src/share/org/apache/catalina/servlets
LocalStrings.properties
  Log:
  Improve webapp unpack WAR file behaviour and enhance manager servlet
  
  Revision  ChangesPath
  1.5   +10 -3 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/LocalStrings.properties,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- LocalStrings.properties   2001/01/23 04:47:57 1.4
  +++ LocalStrings.properties   2001/03/26 03:23:20 1.5
  @@ -7,21 +7,28 @@
   invokerServlet.notNamed=Cannot call invoker servlet with a named dispatcher
   managerServlet.alreadyContext=FAIL - Application already exists at path {0}
   managerServlet.cannotInvoke=Cannot invoke manager servlet through invoker
  -managerServlet.deployed=OK - Deployed application at context path {0}
   managerServlet.exception=FAIL - Encountered exception {0}
  +managerServlet.installed=OK - Installed application at context path {0}
   managerServlet.invalidPath=FAIL - Invalid context path {0} was specified
   managerServlet.invalidWar=FAIL - Invalid application URL {0} was specified
   managerServlet.listed=OK - Listed applications for virtual host {0}
  +managerServlet.listitem={0}:{1}:{2}:{3}
   managerServlet.noCommand=FAIL - No command was specified
   managerServlet.noContext=FAIL - No context exists for path {0}
   managerServlet.noPath=FAIL - No context path was specified
   managerServlet.noRole=FAIL - User does not possess role {0}
   managerServlet.reloaded=OK - Reloaded application at context path {0}
  -managerServlet.undeployed=OK - Undeployed application at context path {0}
  +managerServlet.removed=OK - Removed application at context path {0}
  +managerServlet.sessiondefaultmax=Default maximum session inactive interval {0} 
minutes
  +managerServlet.sessiontimeout={0} minutes:{1} sessions
  +managerServlet.sessions=OK - Session information for application at context path {0}
  +managerServlet.started=OK - Started application at context path {0}
  +managerServlet.stopped=OK - Stopped application at context path {0}
  +managerServlet.unknownCommand=FAIL - Unknown command {0}
   webdavservlet.jaxpfailed=JAXP initialization failed
   directory.filename=Filename
   directory.lastModified=Last Modified
   directory.parent=Up To {0}
   directory.size=Size
   directory.title=Directory Listing For {0}
  -directory.version=Tomcat Catalina version 4.1
  \ No newline at end of file
  +directory.version=Tomcat Catalina version 4.0
  
  
  



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:
* ul
  - * lib/list/b - Return a list of the context paths of all currently
  - * running web applications in this virtual host.
  - * lib/deploy?path=/xxxwar={war-url}/b - Deploy a new web application
  - * attached to context path code/xxx/code, based on the contents of
  - * the web application archive found at the specified URL.
  + * lib/install?path=/xxxwar={war-url}/b - Install and start a new
  + * web application attached to context path code/xxx/code, based
  + * on the contents of the web application archive found at the
  + * specified URL./li
  + * lib/list/b - List the context paths of all currently installed web
  + * applications for this virtual host.  Each context will be listed with
  + * the following format codepath:status:sessions/code.
  + * Where path is the context path.  Status is either running or stopped.
  + * Sessions is the number of active Sessions./li
* lib/reload?path=/xxx/b - Reload the Java classes and resources for
* the application at the specified path, but do not reread the web.xml
  - * configuration files.
  - * lib/undeploy?path=/xxx/b - Remove any web application attached to
  - * context path code/xxx/code from this virtual host.
  + * configuration files./li
  + * lib/remove?path=/xxx/b - Shutdown and remove the web application
  + * attached to context path code/xxx/code for this virtual host./li
  + * lib/sessions?path=/xxx/b - List session information about the web
  + * application attached to context path code/xxx/code for this
  + * virtual host./li
  + * lib/start?path=/xxx/b - Start the web application attached to
  + * context path code/xxx/code for this virtual host./li
  + * lib/stop?path=/xxx/b - Stop the web application attached to
  + * context path code/xxx/code for this virtual host./li
* /ul
  + * pUse codepath=//code for the ROOT context./p
  + * pThe syntax of the URL for a web application archive must conform to one
  + * of the following patterns to be successfully deployed:/p
  + * ul
  + * libfile:/absolute/path/to/a/directory/b - 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./li
  + * libjar:file:/absolute/path/to/a/warfile.war!//b - You can specify a
  + * URL to a local web application archive file.  The syntax must conform to
  + * the rules specified by the codeJarURLConnection/code class for a
  + * reference to an entire JAR file./li
  + * libjar:http://hostname:port/path/to/a/warfile.war!//b - You can specify
  + * a URL to a remote (HTTP-accessible) web application archive file.  The
  + * syntax must conform to the rules specified by the
  + * codeJarURLConnection/code class for a reference to an entire
  + * JAR file./li
  + * /ul
* p
  - * bNOTE/b - Attempting to reload or undeploy the application containing
  + * bNOTE/b - 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

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/resources DirContextURLConnection.java

2001-03-31 Thread glenn

glenn   01/03/31 06:06:31

  Modified:catalina/src/share/org/apache/naming/resources
DirContextURLConnection.java
  Log:
  Implement getPermission so that a FilePermission used to enforce security instead of 
the default AllPermission
  
  Revision  ChangesPath
  1.5   +22 -4 
jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/resources/DirContextURLConnection.java
  
  Index: DirContextURLConnection.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/resources/DirContextURLConnection.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DirContextURLConnection.java  2001/03/21 19:51:48 1.4
  +++ DirContextURLConnection.java  2001/03/31 14:06:31 1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/resources/DirContextURLConnection.java,v
 1.4 2001/03/21 19:51:48 remm Exp $
  - * $Revision: 1.4 $
  - * $Date: 2001/03/21 19:51:48 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/resources/DirContextURLConnection.java,v
 1.5 2001/03/31 14:06:31 glenn Exp $
  + * $Revision: 1.5 $
  + * $Date: 2001/03/31 14:06:31 $
*
* 
*
  @@ -68,6 +68,8 @@
   import java.io.IOException;
   import java.io.InputStream;
   import java.io.FileNotFoundException;
  +import java.io.FilePermission;
  +import java.security.Permission;
   import java.util.Date;
   import java.util.Enumeration;
   import java.util.Vector;
  @@ -89,7 +91,7 @@
* content is directly returned.
* 
* @author a href="mailto:[EMAIL PROTECTED]"Remy Maucherat/a
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
*/
   public class DirContextURLConnection 
   extends URLConnection {
  @@ -103,6 +105,7 @@
   if (context == null)
   throw new IllegalArgumentException
   ("Directory context can't be null");
  +this.permission = new FilePermission(url.toString(),"read");
   this.context = context;
   }
   
  @@ -146,6 +149,12 @@
   protected long date;
   
   
  +/**
  + * Permission
  + */
  +protected Permission permission;
  +
  +
   // - Properties
   
   
  @@ -314,6 +323,15 @@
   }
   
   
  +/**
  + * Get the Permission for this URL
  + */
  +public Permission getPermission() {
  +
  +return permission;
  +}
  +
  +
   // - Public Methods
   
   
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets LocalStrings.properties

2001-03-31 Thread glenn

glenn   01/03/31 06:20:02

  Modified:catalina/src/share/org/apache/catalina/servlets
LocalStrings.properties
  Log:
  Fix manager servlet list string args
  
  Revision  ChangesPath
  1.6   +1 -1  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/LocalStrings.properties
  
  Index: LocalStrings.properties
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/LocalStrings.properties,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- LocalStrings.properties   2001/03/26 03:23:20 1.5
  +++ LocalStrings.properties   2001/03/31 14:20:01 1.6
  @@ -12,7 +12,7 @@
   managerServlet.invalidPath=FAIL - Invalid context path {0} was specified
   managerServlet.invalidWar=FAIL - Invalid application URL {0} was specified
   managerServlet.listed=OK - Listed applications for virtual host {0}
  -managerServlet.listitem={0}:{1}:{2}:{3}
  +managerServlet.listitem={0}:{1}:{2}
   managerServlet.noCommand=FAIL - No command was specified
   managerServlet.noContext=FAIL - No context exists for path {0}
   managerServlet.noPath=FAIL - No context path was specified
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2001-03-31 Thread glenn

glenn   01/03/31 07:21:55

  Modified:catalina/src/share/org/apache/catalina/core
StandardServer.java
  Log:
  Ensure socket ignores and logs SocketPermission AccessControlException's
  
  Revision  ChangesPath
  1.4   +8 -4  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java
  
  Index: StandardServer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StandardServer.java   2001/02/07 01:08:58 1.3
  +++ StandardServer.java   2001/03/31 15:21:55 1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
 1.3 2001/02/07 01:08:58 craigmcc Exp $
  - * $Revision: 1.3 $
  - * $Date: 2001/02/07 01:08:58 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
 1.4 2001/03/31 15:21:55 glenn Exp $
  + * $Revision: 1.4 $
  + * $Date: 2001/03/31 15:21:55 $
*
* 
*
  @@ -70,6 +70,7 @@
   import java.net.InetAddress;
   import java.net.ServerSocket;
   import java.net.Socket;
  +import java.security.AccessControlException;
   import org.apache.catalina.Lifecycle;
   import org.apache.catalina.LifecycleEvent;
   import org.apache.catalina.LifecycleException;
  @@ -86,7 +87,7 @@
* (but not required) when deploying and starting Catalina.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.3 $ $Date: 2001/02/07 01:08:58 $
  + * @version $Revision: 1.4 $ $Date: 2001/03/31 15:21:55 $
*/
   
   public final class StandardServer
  @@ -251,6 +252,9 @@
socket = serverSocket.accept();
socket.setSoTimeout(10 * 1000);  // Ten seconds
stream = socket.getInputStream();
  +} catch (AccessControlException ace) {
  +log("socket accept security exception: " + ace.getMessage());
  +continue;
} catch (IOException e) {
System.err.println("StandardServer.await: accept: " + e);
e.printStackTrace();
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http HttpConnector.java

2001-03-31 Thread glenn

glenn   01/03/31 07:22:11

  Modified:catalina/src/share/org/apache/catalina/connector/http
HttpConnector.java
  Log:
  Ensure socket ignores and logs SocketPermission AccessControlException's
  
  Revision  ChangesPath
  1.10  +8 -4  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java
  
  Index: HttpConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- HttpConnector.java2001/03/17 05:28:38 1.9
  +++ HttpConnector.java2001/03/31 15:22:11 1.10
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java,v
 1.9 2001/03/17 05:28:38 remm Exp $
  - * $Revision: 1.9 $
  - * $Date: 2001/03/17 05:28:38 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http/HttpConnector.java,v
 1.10 2001/03/31 15:22:11 glenn Exp $
  + * $Revision: 1.10 $
  + * $Date: 2001/03/31 15:22:11 $
*
* 
*
  @@ -69,6 +69,7 @@
   import java.net.InetAddress;
   import java.net.ServerSocket;
   import java.net.Socket;
  +import java.security.AccessControlException;
   import java.util.Stack;
   import java.util.Vector;
   import java.util.Enumeration;
  @@ -94,7 +95,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
  - * @version $Revision: 1.9 $ $Date: 2001/03/17 05:28:38 $
  + * @version $Revision: 1.10 $ $Date: 2001/03/31 15:22:11 $
*/
   
   
  @@ -764,6 +765,9 @@
socket = serverSocket.accept();
   if (connectionTimeout  0)
   socket.setSoTimeout(connectionTimeout);
  +} catch (AccessControlException ace) {
  +log("socket accept security exception: " + ace.getMessage());
  +continue;
} catch (IOException e) {
if (started  !stopped)
log("accept: ", e);
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10 HttpConnector.java

2001-03-31 Thread glenn

glenn   01/03/31 07:22:20

  Modified:catalina/src/share/org/apache/catalina/connector/http10
HttpConnector.java
  Log:
  Ensure socket ignores and logs SocketPermission AccessControlException's
  
  Revision  ChangesPath
  1.2   +8 -4  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10/HttpConnector.java
  
  Index: HttpConnector.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10/HttpConnector.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HttpConnector.java2001/01/23 03:55:54 1.1
  +++ HttpConnector.java2001/03/31 15:22:20 1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10/HttpConnector.java,v
 1.1 2001/01/23 03:55:54 remm Exp $
  - * $Revision: 1.1 $
  - * $Date: 2001/01/23 03:55:54 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/http10/HttpConnector.java,v
 1.2 2001/03/31 15:22:20 glenn Exp $
  + * $Revision: 1.2 $
  + * $Date: 2001/03/31 15:22:20 $
*
* 
*
  @@ -69,6 +69,7 @@
   import java.net.InetAddress;
   import java.net.ServerSocket;
   import java.net.Socket;
  +import java.security.AccessControlException;
   import java.util.Stack;
   import java.util.Vector;
   import org.apache.catalina.Connector;
  @@ -93,7 +94,7 @@
* purposes.  Not intended to be the final solution.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.1 $ $Date: 2001/01/23 03:55:54 $
  + * @version $Revision: 1.2 $ $Date: 2001/03/31 15:22:20 $
*/
   
   
  @@ -741,6 +742,9 @@
socket = serverSocket.accept();
   if (connectionTimeout  0)
   socket.setSoTimeout(connectionTimeout);
  +} catch (AccessControlException ace) {
  +log("socket accept security exception: " + ace.getMessage());
  +continue;
} catch (IOException e) {
if (started  !stopped)
log("accept: ", e);
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardServer.java

2001-03-31 Thread glenn

glenn   01/03/31 07:26:21

  Modified:catalina/src/share/org/apache/catalina/core
StandardServer.java
  Log:
  Oops, fix logging of error
  
  Revision  ChangesPath
  1.5   +5 -5  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java
  
  Index: StandardServer.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StandardServer.java   2001/03/31 15:21:55 1.4
  +++ StandardServer.java   2001/03/31 15:26:21 1.5
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
 1.4 2001/03/31 15:21:55 glenn Exp $
  - * $Revision: 1.4 $
  - * $Date: 2001/03/31 15:21:55 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardServer.java,v
 1.5 2001/03/31 15:26:21 glenn Exp $
  + * $Revision: 1.5 $
  + * $Date: 2001/03/31 15:26:21 $
*
* 
*
  @@ -87,7 +87,7 @@
* (but not required) when deploying and starting Catalina.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.4 $ $Date: 2001/03/31 15:21:55 $
  + * @version $Revision: 1.5 $ $Date: 2001/03/31 15:26:21 $
*/
   
   public final class StandardServer
  @@ -253,7 +253,7 @@
socket.setSoTimeout(10 * 1000);  // Ten seconds
stream = socket.getInputStream();
   } catch (AccessControlException ace) {
  -log("socket accept security exception: " + ace.getMessage());
  +System.err.println("StandardServer.accept security exception: " + 
ace.getMessage());
   continue;
} catch (IOException e) {
System.err.println("StandardServer.await: accept: " + e);
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardHost.java

2001-03-31 Thread glenn

glenn   01/03/31 08:32:10

  Modified:catalina/src/share/org/apache/catalina/core
StandardHost.java
  Log:
  Ignore the directory exists exception when context startup try's to expand a war 
file that is already expanded.
  
  Revision  ChangesPath
  1.11  +8 -8  
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHost.java
  
  Index: StandardHost.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHost.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- StandardHost.java 2001/03/26 03:22:57 1.10
  +++ StandardHost.java 2001/03/31 16:32:10 1.11
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHost.java,v
 1.10 2001/03/26 03:22:57 glenn Exp $
  - * $Revision: 1.10 $
  - * $Date: 2001/03/26 03:22:57 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardHost.java,v
 1.11 2001/03/31 16:32:10 glenn Exp $
  + * $Revision: 1.11 $
  + * $Date: 2001/03/31 16:32:10 $
*
* 
*
  @@ -100,7 +100,7 @@
* requests directed to a particular web application.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.10 $ $Date: 2001/03/26 03:22:57 $
  + * @version $Revision: 1.11 $ $Date: 2001/03/31 16:32:10 $
*/
   
   public class StandardHost
  @@ -852,10 +852,10 @@
   (sm.getString("standardHost.appBase",
 appBase.getAbsolutePath()));
   File docBase = new File(appBase, pathname);
  -if (docBase.exists())
  -throw new IOException
  -(sm.getString("standardHost.docBase",
  -  docBase.getAbsolutePath()));
  +if (docBase.exists()) {
  +// War file is already installed
  +return (docBase.getAbsolutePath());
  +}
   docBase.mkdir();
   if (debug = 2)
   log("  Have created expansion directory " +
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/conf catalina.policy

2001-04-11 Thread glenn

glenn   01/04/11 14:32:50

  Modified:catalina/src/conf catalina.policy
  Log:
  Update policy to support JNDI
  
  Revision  ChangesPath
  1.9   +23 -5 jakarta-tomcat-4.0/catalina/src/conf/catalina.policy
  
  Index: catalina.policy
  ===
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/conf/catalina.policy,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- catalina.policy   2001/04/09 00:23:32 1.8
  +++ catalina.policy   2001/04/11 21:32:50 1.9
  @@ -8,7 +8,7 @@
   //
   // * Read access to the document root directory
   //
  -// $Id: catalina.policy,v 1.8 2001/04/09 00:23:32 craigmcc Exp $
  +// $Id: catalina.policy,v 1.9 2001/04/11 21:32:50 glenn Exp $
   // 
   
   
  @@ -83,10 +83,13 @@
   // In addition, a web application will be given a read FilePermission
   // for all files and directories in its document root.
   grant { 
  - permission java.util.PropertyPermission "java.version", "read";
  - permission java.util.PropertyPermission "java.vendor", "read";
  - permission java.util.PropertyPermission "java.vendor.url", "read";
  - permission java.util.PropertyPermission "java.class.version", "read";
  +// Required for JNDI lookup of named JDBC DataSource's and
  +// javamail named MimePart DataSource used to send mail
  +permission java.utim.PropertyPermission "java.home", "read";
  +permission java.util.PropertyPermission "java.naming.*", "read";
  +permission java.util.PropertyPermission "javax.sql.*", "read";
  +
  +// OS Specific properties to allow read access
permission java.util.PropertyPermission "os.name", "read";
permission java.util.PropertyPermission "os.version", "read";
permission java.util.PropertyPermission "os.arch", "read";
  @@ -94,6 +97,11 @@
permission java.util.PropertyPermission "path.separator", "read";
permission java.util.PropertyPermission "line.separator", "read";
   
  +// JVM properties to allow read access
  +permission java.util.PropertyPermission "java.version", "read";
  +permission java.util.PropertyPermission "java.vendor", "read";
  +permission java.util.PropertyPermission "java.vendor.url", "read";
  +permission java.util.PropertyPermission "java.class.version", "read";
permission java.util.PropertyPermission "java.specification.version", "read";
permission java.util.PropertyPermission "java.specification.vendor", "read";
permission java.util.PropertyPermission "java.specification.name", "read";
  @@ -104,6 +112,16 @@
permission java.util.PropertyPermission "java.vm.version", "read";
permission java.util.PropertyPermission "java.vm.vendor", "read";
permission java.util.PropertyPermission "java.vm.name", "read";
  +
  +// Required for reading resources using JNDI lookup
  +permission java.io.FilePermission "jndi:/-", "read";
  +permission java.io.FilePermission "jar:jndi:/WEB-INF/lib/-", "read";
  +// Required for getting BeanInfo
  +permission java.lang.RuntimePermission "accessClassInPackage.sun.beans.*";
  +// Requried for sending email
  +permission java.io.FilePermission "${java.home}${/}lib${/}ext${/}mail.jar", 
"read";
  +
  + // Allow read of JAXP compliant XML parser debug
permission java.util.PropertyPermission "jaxp.debug", "read";
   };
   
  
  
  



cvs commit: jakarta-tomcat/src/etc tomcat.policy

2001-04-13 Thread glenn

glenn   01/04/13 15:09:06

  Modified:src/etc  Tag: tomcat_32 tomcat.policy
  Log:
  Fix PropertyPermission type, add a default grant
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.5.2.2   +27 -5 jakarta-tomcat/src/etc/tomcat.policy
  
  Index: tomcat.policy
  ===
  RCS file: /home/cvs/jakarta-tomcat/src/etc/tomcat.policy,v
  retrieving revision 1.5.2.1
  retrieving revision 1.5.2.2
  diff -u -r1.5.2.1 -r1.5.2.2
  --- tomcat.policy 2000/12/28 22:11:00 1.5.2.1
  +++ tomcat.policy 2001/04/13 22:09:06 1.5.2.2
  @@ -2,16 +2,16 @@
   
   // javac
   grant codeBase "file:${java.home}/../lib/-" {
  -   permission java.security.AllPermission;
  +permission java.security.AllPermission;
   };
   
   // Tomcat gets all permissions
   grant codeBase "file:${tomcat.home}/lib/-" {
  -   permission java.security.AllPermission;
  +permission java.security.AllPermission;
   };
   
   grant codeBase "file:${tomcat.home}/classes/-" {
  - permission java.security.AllPermission;
  +permission java.security.AllPermission;
   };
   
   // Example webapp policy
  @@ -19,7 +19,29 @@
   // line.separator, path.separator, and file.separator PropertyPermissions. 
   // Any permissions you grant here are in addition to the default.
   grant codeBase "file:${tomcat.home}/webapps/examples" {
  -  // Allow the example web application to read all java properties
  -  permission java.util.ProperyPermission "*", "read";
  +// Allow the example web application to read all java properties
  +permission java.util.PropertyPermission "*", "read";
   };
   
  +grant {
  +// OS Specific properties to allow read access
  +permission java.util.PropertyPermission "os.name", "read";
  +permission java.util.PropertyPermission "os.version", "read";
  +permission java.util.PropertyPermission "os.arch", "read";
  + 
  +// JVM properties to allow read access
  +permission java.util.PropertyPermission "java.version", "read";
  +permission java.util.PropertyPermission "java.vendor", "read";
  +permission java.util.PropertyPermission "java.vendor.url", "read";
  +permission java.util.PropertyPermission "java.class.version", "read";
  +permission java.util.PropertyPermission "java.specification.version", "read";
  +permission java.util.PropertyPermission "java.specification.vendor", "read";
  +permission java.util.PropertyPermission "java.specification.name", "read";
  +
  +permission java.util.PropertyPermission "java.vm.specification.version", "read";
  +permission java.util.PropertyPermission "java.vm.specification.vendor", "read";
  +permission java.util.PropertyPermission "java.vm.specification.name", "read";
  +permission java.util.PropertyPermission "java.vm.version", "read";
  +permission java.util.PropertyPermission "java.vm.vendor", "read";
  +permission java.util.PropertyPermission "java.vm.name", "read";
  +};
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/resources DirContextURLConnection.java

2001-04-24 Thread glenn

glenn   01/04/24 21:15:39

  Modified:catalina/src/share/org/apache/naming/resources
DirContextURLConnection.java
  Log:
  Java SecurityManager implementation changes
  ---
  
  Changed the naming convention for JNDI DirContextURL to
  jndi:/hostname/webappname/ and jar:jndi:/hostname/webappname/
  This works better with java.io.FilePermission.
  
  Modified how permissions are granted to the codeBase for a
  web application so that different permissions can be granted.
  Permissions assigned to the root of a web application apply
  to JSP pages.  Different permissions can be assigned to the
  /WEB-INF/classes/ directory, the /WEB-INF/lib/ directory,
  or even to individual jar files in /WEB-INF/lib/.  This allows
  much finer control of permissions granted within a web
  application.
  
  Fixed Jasper so that it uses the correct codeBase for a
  web application, it had been using the work dir instead
  of the context dir for getting permissions from the
  policy file.
  
  Added more default read FilePermissions for classes
  loaded from within a web application so that getResources()
  works. Added:
  
  jndi:/hostname/webappname/-
  jar:jndi:/hostname/webappname/WEB-INF/lib/-
  file:/realcontextpath/-
  
  Revision  ChangesPath
  1.7   +7 -6  
jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/resources/DirContextURLConnection.java
  
  Index: DirContextURLConnection.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/resources/DirContextURLConnection.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DirContextURLConnection.java  2001/04/06 19:31:59 1.6
  +++ DirContextURLConnection.java  2001/04/25 04:15:38 1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/resources/DirContextURLConnection.java,v
 1.6 2001/04/06 19:31:59 remm Exp $
  - * $Revision: 1.6 $
  - * $Date: 2001/04/06 19:31:59 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/naming/resources/DirContextURLConnection.java,v
 1.7 2001/04/25 04:15:38 glenn Exp $
  + * $Revision: 1.7 $
  + * $Date: 2001/04/25 04:15:38 $
*
* 
*
  @@ -91,7 +91,7 @@
* content is directly returned.
* 
* @author a href=mailto:[EMAIL PROTECTED];Remy Maucherat/a
  - * @version $Revision: 1.6 $
  + * @version $Revision: 1.7 $
*/
   public class DirContextURLConnection 
   extends URLConnection {
  @@ -179,11 +179,12 @@
   String hostName = proxyDirContext.getHostName();
   String contextName = proxyDirContext.getContextName();
   if (hostName != null) {
  -if (!url.getHost().equalsIgnoreCase(hostName))
  +if (!path.startsWith(/ + hostName + /))
   return;
  +path = path.substring(hostName.length()+ 1);
   }
   if (contextName != null) {
  -if (!path.startsWith(contextName)) {
  +if (!path.startsWith(contextName + /)) {
   return;
   } else {
   path = path.substring(contextName.length());
  
  
  



cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet JspServlet.java

2001-04-24 Thread glenn

glenn   01/04/24 21:16:07

  Modified:jasper/src/share/org/apache/jasper/servlet JspServlet.java
  Log:
  Java SecurityManager implementation changes
  ---
  
  Changed the naming convention for JNDI DirContextURL to
  jndi:/hostname/webappname/ and jar:jndi:/hostname/webappname/
  This works better with java.io.FilePermission.
  
  Modified how permissions are granted to the codeBase for a
  web application so that different permissions can be granted.
  Permissions assigned to the root of a web application apply
  to JSP pages.  Different permissions can be assigned to the
  /WEB-INF/classes/ directory, the /WEB-INF/lib/ directory,
  or even to individual jar files in /WEB-INF/lib/.  This allows
  much finer control of permissions granted within a web
  application.
  
  Fixed Jasper so that it uses the correct codeBase for a
  web application, it had been using the work dir instead
  of the context dir for getting permissions from the
  policy file.
  
  Added more default read FilePermissions for classes
  loaded from within a web application so that getResources()
  works. Added:
  
  jndi:/hostname/webappname/-
  jar:jndi:/hostname/webappname/WEB-INF/lib/-
  file:/realcontextpath/-
  
  Revision  ChangesPath
  1.17  +27 -5 
jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet/JspServlet.java
  
  Index: JspServlet.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/servlet/JspServlet.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- JspServlet.java   2001/03/21 20:49:20 1.16
  +++ JspServlet.java   2001/04/25 04:16:06 1.17
  @@ -288,20 +288,42 @@
if( policy != null ) {
   try {  
// Get the permissions for the web app context
  - URL url = options.getScratchDir().toURL();
  +String contextDir = context.getRealPath(/);
  +if( contextDir == null )
  +contextDir = options.getScratchDir().toString();
  + URL url = new URL(file: + contextDir);
codeSource = new CodeSource(url,null);
permissionCollection = policy.getPermissions(codeSource);
// Create a file read permission for web app context directory
  - String contextDir = url.getFile();
  - if( contextDir.endsWith(File.separator) )
  + if (contextDir.endsWith(File.separator))
contextDir = contextDir + -;
else
contextDir = contextDir + File.separator + -;
permissionCollection.add( new FilePermission(contextDir,read) );
// Allow the JSP to access org.apache.jasper.runtime.HttpJspBase
permissionCollection.add( new RuntimePermission(
  - accessClassInPackage.org.apache.jasper.runtime
  - ) );
  + accessClassInPackage.org.apache.jasper.runtime) );
  +if (parentClassLoader instanceof URLClassLoader) {
  +URL [] urls = parentClassLoader.getURLs();
  +String jarUrl = null;
  +String jndiUrl = null;
  +for (int i=0; iurls.length; i++) {
  +if (jndiUrl == null  
urls[i].toString().startsWith(jndi:) ) {
  +jndiUrl = urls[i].toString() + -;
  +}
  +if (jarUrl == null  
urls[i].toString().startsWith(jar:jndi:) ) {
  +jarUrl = urls[i].toString();
  +jarUrl = jarUrl.substring(0,jarUrl.length() - 2);
  +jarUrl = jarUrl.substring(0,jarUrl.lastIndexOf('/')) + 
/-;
  +}
  +}
  +if (jarUrl != null) {
  +permissionCollection.add( new FilePermission(jarUrl,read) 
);
  +permissionCollection.add( new 
FilePermission(jarUrl.substring(4),read) );
  +}
  +if (jndiUrl != null)
  +permissionCollection.add( new 
FilePermission(jndiUrl,read) );
  +}
} catch(MalformedURLException mfe) {
}
}
  
  
  



cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java

2001-04-25 Thread glenn

glenn   01/04/25 18:14:04

  Modified:catalina/src/share/org/apache/catalina/core
ApplicationContext.java
  Log:
  Wrap servlet logging with doPrivileged
  
  Revision  ChangesPath
  1.22  +88 -7 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java
  
  Index: ApplicationContext.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- ApplicationContext.java   2001/04/25 17:17:49 1.21
  +++ ApplicationContext.java   2001/04/26 01:14:02 1.22
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v
 1.21 2001/04/25 17:17:49 craigmcc Exp $
  - * $Revision: 1.21 $
  - * $Date: 2001/04/25 17:17:49 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v
 1.22 2001/04/26 01:14:02 glenn Exp $
  + * $Revision: 1.22 $
  + * $Date: 2001/04/26 01:14:02 $
*
* 
*
  @@ -111,7 +111,7 @@
*
* @author Craig R. McClanahan
* @author Remy Maucherat
  - * @version $Revision: 1.21 $ $Date: 2001/04/25 17:17:49 $
  + * @version $Revision: 1.22 $ $Date: 2001/04/26 01:14:02 $
*/
   
   public final class ApplicationContext
  @@ -158,10 +158,10 @@
   
   protected class PrivilegedGetResource 
   implements PrivilegedExceptionAction {
  -
  - private String path;
  +  
  +private String path;  
   private String host;
  - private DirContext resources;
  +private DirContext resources;
   
   PrivilegedGetResource(String host, String path, DirContext resources) {
   this.host = host;
  @@ -176,7 +176,59 @@
   
   }
   
  +protected class PrivilegedLogMessage
  +implements PrivilegedAction {
  +  
  +private String message;  
  + 
  +PrivilegedLogMessage(String message) {
  +this.message = message;
  +}  
  +   
  +public Object run() {
  +internalLog(message);
  +return null;
  +}
  +  
  +}
  +
  +protected class PrivilegedLogException
  +implements PrivilegedAction {
  +  
  +private String message;
  +private Exception exception;
  + 
  +PrivilegedLogException(Exception exception,String message) {
  +this.message = message;
  +this.exception = exception;
  +}  
  +   
  +public Object run() {
  +internalLog(exception,message);
  +return null;
  +}
  +  
  +}
  +
  +protected class PrivilegedLogThrowable
  +implements PrivilegedAction {
  +
  +private String message;
  +private Throwable throwable;
  +
  +PrivilegedLogThrowable(String message,Throwable throwable) {
  +this.message = message;   
  +this.throwable = throwable;
  +} 
  +  
  +public Object run() { 
  +internalLog(message,throwable);
  +return null;  
  +}   
  +  
  +}
   
  +
   // --- Constructors
   
   
  @@ -682,7 +734,17 @@
* @param message Message to be written
*/
   public void log(String message) {
  +if( System.getSecurityManager() != null ) {
  +PrivilegedLogMessage dp =
  +new PrivilegedLogMessage(message);
  +AccessController.doPrivileged(dp);
  +} else {
  +internalLog(message);
  +}
  +}
   
  +private void internalLog(String message) {
  +
Logger logger = context.getLogger();
if (logger != null)
logger.log(message);
  @@ -700,7 +762,16 @@
*  codelog(String, Throwable)/code instead
*/
   public void log(Exception exception, String message) {
  +if( System.getSecurityManager() != null ) {
  +PrivilegedLogException dp =
  +new

cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup Bootstrap.java

2001-04-25 Thread glenn

glenn   01/04/25 18:14:18

  Modified:catalina/src/share/org/apache/catalina/startup
Bootstrap.java
  Log:
  Wrap servlet logging with doPrivileged
  
  Revision  ChangesPath
  1.16  +13 -4 
jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Bootstrap.java
  
  Index: Bootstrap.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Bootstrap.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Bootstrap.java2001/04/08 00:03:59 1.15
  +++ Bootstrap.java2001/04/26 01:14:17 1.16
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Bootstrap.java,v
 1.15 2001/04/08 00:03:59 remm Exp $
  - * $Revision: 1.15 $
  - * $Date: 2001/04/08 00:03:59 $
  + * $Header: 
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/Bootstrap.java,v
 1.16 2001/04/26 01:14:17 glenn Exp $
  + * $Revision: 1.16 $
  + * $Date: 2001/04/26 01:14:17 $
*
* 
*
  @@ -85,7 +85,7 @@
* class path and therefore not visible to application level classes.
*
* @author Craig R. McClanahan
  - * @version $Revision: 1.15 $ $Date: 2001/04/08 00:03:59 $
  + * @version $Revision: 1.16 $ $Date: 2001/04/26 01:14:17 $
*/
   
   public final class Bootstrap {
  @@ -134,6 +134,15 @@
   catalinaLoader.loadClass
   (basePackage +
core.ApplicationContext$PrivilegedGetRequestDispatcher);
  +catalinaLoader.loadClass
  +(basePackage +  
  + core.ApplicationContext$PrivilegedLogMessage);
  +catalinaLoader.loadClass
  +(basePackage +  
  + core.ApplicationContext$PrivilegedLogException);
  +catalinaLoader.loadClass
  +(basePackage +  
  + core.ApplicationContext$PrivilegedLogThrowable);
   catalinaLoader.loadClass
   (basePackage +
core.ApplicationDispatcher$PrivilegedForward);
  
  
  



  1   2   3   4   5   6   7   8   9   >