craigmcc    01/03/21 12:49:23

  Modified:    jasper/src/share/org/apache/jasper Constants.java
                        JspEngineContext.java
               jasper/src/share/org/apache/jasper/servlet JspServlet.java
  Log:
  Revert Glenn's changes to classpath construction, at least until after
  Beta 2.  The current changes break things.
  
  Revision  Changes    Path
  1.10      +9 -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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Constants.java    2001/03/21 12:36:51     1.9
  +++ Constants.java    2001/03/21 20:49:07     1.10
  @@ -104,6 +104,15 @@
        * Other servlet engines can choose to have this attribute if they 
        * want to have this JSP engine running on them. 
        */
  +    //public static final String SERVLET_CLASSPATH = 
"org.apache.tomcat.jsp_classpath";
  +    public static final String SERVLET_CLASSPATH = 
"org.apache.catalina.jsp_classpath";
  +
  +    /**
  +     * FIXME
  +     * ServletContext attribute for classpath. This is tomcat specific. 
  +     * Other servlet engines can choose to have this attribute if they 
  +     * want to have this JSP engine running on them. 
  +     */
       //public static final String SERVLET_CLASS_LOADER = 
"org.apache.tomcat.classloader";
       public static final String SERVLET_CLASS_LOADER = 
"org.apache.catalina.classloader";
   
  
  
  
  1.7       +3 -30     
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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- JspEngineContext.java     2001/03/21 12:37:20     1.6
  +++ JspEngineContext.java     2001/03/21 20:49:10     1.7
  @@ -1,7 +1,7 @@
   /*
  - * $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 $
  + * $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 $
    *
    * ====================================================================
    * 
  @@ -145,44 +145,17 @@
   
       /**
        * 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++) {
  -         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);
  +            cpath.append((String)urls[i].getFile()+sep);
           }
  -        return cpath.toString();
  +         
  +        return cpath.toString() + classpath;
       }
       
       /**
  
  
  
  1.16      +21 -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.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- JspServlet.java   2001/03/21 12:37:55     1.15
  +++ JspServlet.java   2001/03/21 20:49:20     1.16
  @@ -150,10 +150,27 @@
        private void loadIfNecessary(HttpServletRequest req, HttpServletResponse res) 
               throws JasperException, ServletException, FileNotFoundException 
           {
  -         // Get the classpath init parameter
  -            String cp = options.getClassPath();
  -         if( cp == null )
  -             cp = "";
  +            // 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);
   
               if (loadJSP(jspUri, cp, isErrorPage, req, res) 
                       || theServlet == null) {
  
  
  

Reply via email to