tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@locus.apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core Constants.java StandardWrapper.java
Date Sat, 02 Sep 2000 00:50:04 GMT
craigmcc    00/09/01 17:50:04

  Modified:    catalina/src/share/org/apache/catalina/core Constants.java
                        StandardWrapper.java
  Log:
  Initial support for the <jsp-file> element of a servlet, which lets you
  specify a JSP page, rather than a servlet class, to be the object that is
  executed when this "servlet" is requested.
  
  It appears that there needs to be some cooperation from Jasper in this --
  I get "error 404" when I try it.
  
  Revision  Changes    Path
  1.4       +4 -3      jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/Constants.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Constants.java	2000/08/24 23:56:59	1.3
  +++ Constants.java	2000/09/02 00:50:02	1.4
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/Constants.java,v
1.3 2000/08/24 23:56:59 craigmcc Exp $
  - * $Revision: 1.3 $
  - * $Date: 2000/08/24 23:56:59 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/Constants.java,v
1.4 2000/09/02 00:50:02 craigmcc Exp $
  + * $Revision: 1.4 $
  + * $Date: 2000/09/02 00:50:02 $
    *
    * ====================================================================
    *
  @@ -71,5 +71,6 @@
       public static final int MAJOR_VERSION = 2;
       public static final int MINOR_VERSION = 3;
   
  +    public static final String JSP_SERVLET_NAME = "jsp";
   
   }
  
  
  
  1.6       +23 -13    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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StandardWrapper.java	2000/08/24 22:37:08	1.5
  +++ StandardWrapper.java	2000/09/02 00:50:03	1.6
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapper.java,v
1.5 2000/08/24 22:37:08 craigmcc Exp $
  - * $Revision: 1.5 $
  - * $Date: 2000/08/24 22:37:08 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapper.java,v
1.6 2000/09/02 00:50:03 craigmcc Exp $
  + * $Revision: 1.6 $
  + * $Date: 2000/09/02 00:50:03 $
    *
    * ====================================================================
    *
  @@ -100,7 +100,7 @@
    * make them efficient are counter-productive.
    *
    * @author Craig R. McClanahan
  - * @version $Revision: 1.5 $ $Date: 2000/08/24 22:37:08 $
  + * @version $Revision: 1.6 $ $Date: 2000/09/02 00:50:03 $
    */
   
   public final class StandardWrapper
  @@ -675,9 +675,19 @@
   	if (instance != null)
   	    return;
   
  +        // If this "servlet" is really a JSP file, get the right class
  +        // FIXME - This still does not solve all the problems, but it is
  +        // pretty close to what Tomcat 3.x does
  +        String actualClass = servletClass;
  +        if ((actualClass == null) && (jspFile != null)) {
  +            Wrapper jspWrapper = (Wrapper)
  +                ((Context) getParent()).findChild(Constants.JSP_SERVLET_NAME);
  +            if (jspWrapper != null)
  +                actualClass = jspWrapper.getServletClass();
  +        }
  +
   	// Complain if no servlet class has been specified
  -	// FIXME - support for JSP file servlets!!!
  -	if (servletClass == null) {
  +	if (actualClass == null) {
   	    unavailable(null);
   	    throw new ServletException
   		(sm.getString("standardWrapper.notClass", getName()));
  @@ -691,7 +701,7 @@
   		(sm.getString("standardWrapper.missingLoader", getName()));
   	}
   	ClassLoader classLoader = loader.getClassLoader();
  -	if (isContainerServlet(servletClass)) {
  +	if (isContainerServlet(actualClass)) {
   	    classLoader = this.getClass().getClassLoader();
   	    log(sm.getString
   	          ("standardWrapper.containerServlet", getName()));
  @@ -701,19 +711,19 @@
   	Class classClass = null;
   	try {
   	    if (classLoader != null)
  -		classClass = classLoader.loadClass(servletClass);
  +		classClass = classLoader.loadClass(actualClass);
   	    else
  -		classClass = Class.forName(servletClass);
  +		classClass = Class.forName(actualClass);
   	} catch (ClassNotFoundException e) {
   	    unavailable(null);
   	    throw new ServletException
  -		(sm.getString("standardWrapper.missingClass", servletClass),
  +		(sm.getString("standardWrapper.missingClass", actualClass),
   		 e);
   	}
   	if (classClass == null) {
   	    unavailable(null);
   	    throw new ServletException
  -		(sm.getString("standardWrapper.missingClass", servletClass));
  +		(sm.getString("standardWrapper.missingClass", actualClass));
   	}
   
   	// Instantiate and initialize an instance of the servlet class itself
  @@ -723,11 +733,11 @@
   	} catch (ClassCastException e) {
   	    unavailable(null);
   	    throw new ServletException
  -		(sm.getString("standardWrapper.notServlet", servletClass), e);
  +		(sm.getString("standardWrapper.notServlet", actualClass), e);
   	} catch (Throwable e) {
   	    unavailable(null);
   	    throw new ServletException
  -		(sm.getString("standardWrapper.instantiate", servletClass), e);
  +		(sm.getString("standardWrapper.instantiate", actualClass), e);
   	}
   
   	// Call the initialization method of this servlet
  
  
  

Mime
View raw message