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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to