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/09/06 01:59:08 UTC
cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core StandardWrapper.java StandardWrapperValve.java
craigmcc 00/09/05 16:59:08
Modified: catalina/src/share/org/apache/catalina/core
StandardWrapper.java StandardWrapperValve.java
Log:
Finish dealing with servlets defined using <jsp-file> instead of
<servlet-class>, by modifying the values returned by getRequestURI() and
getServletPath() so that Jasper will know which JSP page to load.
This is based on the assumption that the value specified for <jsp-file> is
a context-relative path starting with a "/".
Revision Changes Path
1.7 +9 -7 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapper.java
Index: StandardWrapper.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapper.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- StandardWrapper.java 2000/09/02 00:50:03 1.6
+++ StandardWrapper.java 2000/09/05 23:59:07 1.7
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapper.java,v 1.6 2000/09/02 00:50:03 craigmcc Exp $
- * $Revision: 1.6 $
- * $Date: 2000/09/02 00:50:03 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapper.java,v 1.7 2000/09/05 23:59:07 craigmcc Exp $
+ * $Revision: 1.7 $
+ * $Date: 2000/09/05 23:59:07 $
*
* ====================================================================
*
@@ -100,7 +100,7 @@
* make them efficient are counter-productive.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.6 $ $Date: 2000/09/02 00:50:03 $
+ * @version $Revision: 1.7 $ $Date: 2000/09/05 23:59:07 $
*/
public final class StandardWrapper
@@ -675,9 +675,11 @@
if (instance != null)
return;
- // If this "servlet" is really a JSP file, get the right class
- // FIXME - This still does not solve all the problems, but it is
- // pretty close to what Tomcat 3.x does
+ // If this "servlet" is really a JSP file, get the right class.
+ // HOLD YOUR NOSE - this is a kludge that avoids having to do special
+ // case Catalina-specific code in Jasper - it also requires that the
+ // servlet path be replaced by the <jsp-file> element content in
+ // order to be completely effective
String actualClass = servletClass;
if ((actualClass == null) && (jspFile != null)) {
Wrapper jspWrapper = (Wrapper)
1.7 +21 -4 jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java
Index: StandardWrapperValve.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- StandardWrapperValve.java 2000/08/24 23:57:00 1.6
+++ StandardWrapperValve.java 2000/09/05 23:59:07 1.7
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v 1.6 2000/08/24 23:57:00 craigmcc Exp $
- * $Revision: 1.6 $
- * $Date: 2000/08/24 23:57:00 $
+ * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/core/StandardWrapperValve.java,v 1.7 2000/09/05 23:59:07 craigmcc Exp $
+ * $Revision: 1.7 $
+ * $Date: 2000/09/05 23:59:07 $
*
* ====================================================================
*
@@ -103,7 +103,7 @@
* <code>StandardWrapper</code> container implementation.
*
* @author Craig R. McClanahan
- * @version $Revision: 1.6 $ $Date: 2000/08/24 23:57:00 $
+ * @version $Revision: 1.7 $ $Date: 2000/09/05 23:59:07 $
*/
final class StandardWrapperValve
@@ -162,6 +162,23 @@
HttpServletResponse hres = null;
if (sres instanceof HttpServletResponse)
hres = (HttpServletResponse) sres;
+
+ // HOLD YOUR NOSE - Kludge to deal with <jsp-file> servlets.
+ // Modify the request paths for a servlet that was defined
+ // with a <jsp-file> element instead of a <servlet-class>.
+ String jspFile = wrapper.getJspFile();
+ if ((hreq != null) && (hres != null) && (jspFile != null)) {
+ StringBuffer sb = new StringBuffer();
+ String contextPath = hreq.getContextPath();
+ if (contextPath != null)
+ sb.append(contextPath);
+ sb.append(jspFile);
+ String pathInfo = hreq.getPathInfo();
+ if (pathInfo != null)
+ sb.append(pathInfo);
+ ((HttpRequest) request).setRequestURI(sb.toString());
+ ((HttpRequest) request).setServletPath(jspFile);
+ }
// Check for the servlet being marked unavailable
if (wrapper.isUnavailable()) {