tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets DefaultServlet.java
Date Sat, 17 Mar 2001 05:24:29 GMT
remm        01/03/16 21:24:29

  Modified:    catalina/src/share/org/apache/catalina/servlets
                        DefaultServlet.java
  Log:
  - Try to retrieve the resources from the servlet context first.
  
  Revision  Changes    Path
  1.29      +18 -13    jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java
  
  Index: DefaultServlet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- DefaultServlet.java	2001/03/09 05:04:21	1.28
  +++ DefaultServlet.java	2001/03/17 05:24:28	1.29
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
1.28 2001/03/09 05:04:21 remm Exp $
  - * $Revision: 1.28 $
  - * $Date: 2001/03/09 05:04:21 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/servlets/DefaultServlet.java,v
1.29 2001/03/17 05:24:28 remm Exp $
  + * $Revision: 1.29 $
  + * $Date: 2001/03/17 05:24:28 $
    *
    * ====================================================================
    *
  @@ -122,7 +122,7 @@
    *
    * @author Craig R. McClanahan
    * @author Remy Maucherat
  - * @version $Revision: 1.28 $ $Date: 2001/03/09 05:04:21 $
  + * @version $Revision: 1.29 $ $Date: 2001/03/17 05:24:28 $
    */
   
   public class DefaultServlet
  @@ -352,25 +352,30 @@
        */
       protected DirContext getResources() {
   
  -        // First : try JNDI
  +        DirContext result = null;
  +
  +        // Try the servlet context
           try {
  -            return 
  -                (DirContext) new InitialContext().lookup(RESOURCES_JNDI_NAME);
  -        } catch (NamingException e) {
  -            // Failed
  +            result = (DirContext) getServletContext()
  +                .getAttribute(Globals.RESOURCES_ATTR);
           } catch (ClassCastException e) {
               // Failed : Not the right type
           }
   
  -        // If it has failed, try the servlet context
  +        if (result != null)
  +            return result;
  +
  +        // Try JNDI
           try {
  -            return (DirContext) getServletContext()
  -                .getAttribute(Globals.RESOURCES_ATTR);
  +            result =
  +                (DirContext) new InitialContext().lookup(RESOURCES_JNDI_NAME);
  +        } catch (NamingException e) {
  +            // Failed
           } catch (ClassCastException e) {
               // Failed : Not the right type
           }
   
  -        return null;
  +        return result;
   
       }
   
  
  
  

Mime
View raw message