You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by cr...@locus.apache.org on 2000/10/05 21:38:17 UTC
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core ApplicationContext.java ApplicationDispatcher.java
craigmcc 00/10/05 12:38:13
Modified: catalina/src/share/org/apache/catalina/core
ApplicationContext.java ApplicationDispatcher.java
Log:
Implement a non-standard request attribute that is set on named dispatcher
includes so that Jasper (or any other included servlet) can always tell
when it is executing inside an include, instead of a direct call.
For a path-based include, the included servlet should check for the
existence of the standard request attributes that are added.
Revision Changes Path
1.6 +7 -6 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java
Index: ApplicationContext.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ApplicationContext.java 2000/09/24 02:52:59 1.5
+++ ApplicationContext.java 2000/10/05 19:38:00 1.6
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.5 2000/09/24 02:52:59 craigmcc Exp $
- * $Revision: 1.5 $
- * $Date: 2000/09/24 02:52:59 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationContext.java,v 1.6 2000/10/05 19:38:00 craigmcc Exp $
+ * $Revision: 1.6 $
+ * $Date: 2000/10/05 19:38:00 $
*
* ====================================================================
*
@@ -97,7 +97,7 @@
* associated with each instance of <code>StandardContext</code>.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.5 $ $Date: 2000/09/24 02:52:59 $
+ * @version $Revision: 1.6 $ $Date: 2000/10/05 19:38:00 $
*/
public final class ApplicationContext
@@ -326,7 +326,7 @@
if (wrapper == null)
return (null);
ApplicationDispatcher dispatcher =
- new ApplicationDispatcher(wrapper, null, null, null);
+ new ApplicationDispatcher(wrapper, null, null, null, name);
return ((RequestDispatcher) dispatcher);
}
@@ -413,7 +413,8 @@
new ApplicationDispatcher(wrapper,
hrequest.getServletPath(),
hrequest.getPathInfo(),
- hrequest.getQueryString());
+ hrequest.getQueryString(),
+ null);
return ((RequestDispatcher) dispatcher);
}
1.5 +22 -8 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java
Index: ApplicationDispatcher.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ApplicationDispatcher.java 2000/09/28 00:25:31 1.4
+++ ApplicationDispatcher.java 2000/10/05 19:38:00 1.5
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v 1.4 2000/09/28 00:25:31 craigmcc Exp $
- * $Revision: 1.4 $
- * $Date: 2000/09/28 00:25:31 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/ApplicationDispatcher.java,v 1.5 2000/10/05 19:38:00 craigmcc Exp $
+ * $Revision: 1.5 $
+ * $Date: 2000/10/05 19:38:00 $
*
* ====================================================================
*
@@ -94,7 +94,7 @@
* <code>javax.servlet.ServletResponseWrapper</code>.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.4 $ $Date: 2000/09/28 00:25:31 $
+ * @version $Revision: 1.5 $ $Date: 2000/10/05 19:38:00 $
*/
final class ApplicationDispatcher
@@ -117,10 +117,12 @@
* (if any)
* @param queryString Query string parameters included with this request
* (if any)
+ * @param name Servlet name (if a named dispatcher was created)
+ * else <code>null</code>
*/
public ApplicationDispatcher
(Wrapper wrapper, String servletPath,
- String pathInfo, String queryString) {
+ String pathInfo, String queryString, String name) {
super();
@@ -130,10 +132,12 @@
this.servletPath = servletPath;
this.pathInfo = pathInfo;
this.queryString = queryString;
+ this.name = name;
if (debug >= 1)
log("servletPath=" + this.servletPath + ", pathInfo=" +
- this.pathInfo + ", queryString=" + queryString);
+ this.pathInfo + ", queryString=" + queryString +
+ ", name=" + this.name);
}
@@ -154,6 +158,12 @@
/**
+ * The servlet name for a named dispatcher.
+ */
+ private String name = null;
+
+
+ /**
* The extra path information for this RequestDispatcher.
*/
private String pathInfo = null;
@@ -356,13 +366,17 @@
}
// Handle an HTTP named dispatcher include
- else if ((servletPath == null) && (pathInfo == null)) {
+ else if (name != null) {
if (debug >= 1)
log(" Named Dispatcher Include");
+ ApplicationHttpRequest wrequest =
+ new ApplicationHttpRequest((HttpServletRequest) request);
+ wrequest.setAttribute("org.apache.catalina.NAMED", name);
+
try {
- invoke(request, wresponse);
+ invoke(wrequest, wresponse);
} catch (IOException e) {
throw e;
} catch (ServletException e) {