tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java
Date Mon, 05 Apr 2004 22:40:07 GMT
luehe       2004/04/05 15:40:07

  Modified:    catalina/src/share/org/apache/catalina/core
                        StandardContext.java
  Log:
  Allow webapp to override JspServlet (settings) inherited from global web.xml
  
  Revision  Changes    Path
  1.123     +21 -2     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java
  
  Index: StandardContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
  retrieving revision 1.122
  retrieving revision 1.123
  diff -u -r1.122 -r1.123
  --- StandardContext.java	25 Mar 2004 22:31:46 -0000	1.122
  +++ StandardContext.java	5 Apr 2004 22:40:07 -0000	1.123
  @@ -1733,10 +1733,29 @@
        */
       public void addChild(Container child) {
   
  -        if (!(child instanceof Wrapper))
  +        if (!(child instanceof Wrapper)) {
               throw new IllegalArgumentException
                   (sm.getString("standardContext.notWrapper"));
  +        }
  +
           Wrapper wrapper = (Wrapper) child;
  +
  +        /*
  +         * Allow webapp to override JspServlet inherited from global web.xml.
  +         * The webapp-specific JspServlet inherits all the mappings specified
  +         * in the global web.xml, and may add additional ones.
  +         */
  +        if ("jsp".equals(wrapper.getName())) {
  +            Wrapper jspServlet = (Wrapper) findChild("jsp");
  +            if (jspServlet != null) {
  +                String[] jspMappings = jspServlet.findMappings();
  +                for (int i=0; jspMappings!=null && i<jspMappings.length; i++)
{
  +                    wrapper.addMapping(jspMappings[i]);
  +                }
  +                removeChild(jspServlet);
  +            }
  +        }
  +
           String jspFile = wrapper.getJspFile();
           if ((jspFile != null) && !jspFile.startsWith("/")) {
               if (isServlet22()) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message