luehe 2004/04/07 14:34:12
Modified: catalina/src/share/org/apache/catalina/core
StandardContext.java
Log:
When the webapp specific JspServlet inherits the mappings from the
global JspServlet, we need to wipe out the wrapper corresponding to
the global JspServlet from the mapper (by calling
StandardContext.addServletMapping() instead of
StandardWrapper.addMapping())
Revision Changes Path
1.125 +20 -14
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.124
retrieving revision 1.125
diff -u -r1.124 -r1.125
--- StandardContext.java 7 Apr 2004 02:27:47 -0000 1.124
+++ StandardContext.java 7 Apr 2004 21:34:12 -0000 1.125
@@ -1731,26 +1731,22 @@
*/
public void addChild(Container child) {
+ // Global JspServlet
+ Wrapper oldJspServlet = null;
+
if (!(child instanceof Wrapper)) {
throw new IllegalArgumentException
(sm.getString("standardContext.notWrapper"));
}
Wrapper wrapper = (Wrapper) child;
+ boolean isJspServlet = "jsp".equals(child.getName());
- /*
- * 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);
+ // Allow webapp to override JspServlet inherited from global web.xml.
+ if (isJspServlet) {
+ oldJspServlet = (Wrapper) findChild("jsp");
+ if (oldJspServlet != null) {
+ removeChild(oldJspServlet);
}
}
@@ -1768,6 +1764,16 @@
super.addChild(child);
+ if (isJspServlet && oldJspServlet != null) {
+ /*
+ * The webapp-specific JspServlet inherits all the mappings
+ * specified in the global web.xml, and may add additional ones.
+ */
+ String[] jspMappings = oldJspServlet.findMappings();
+ for (int i=0; jspMappings!=null && i<jspMappings.length; i++) {
+ addServletMapping(jspMappings[i], child.getName());
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]