You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2014/09/22 13:44:15 UTC

svn commit: r1626742 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/jasper/Constants.java java/org/apache/jasper/servlet/JspServlet.java webapps/docs/changelog.xml webapps/docs/config/systemprops.xml

Author: markt
Date: Mon Sep 22 11:44:15 2014
New Revision: 1626742

URL: http://svn.apache.org/r1626742
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56991
Deprecate the use of a request attribute to pass a <jsp-file> declaration to Jasper and prevent an infinite loop if this technique is used in conjunction with an include.

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/java/org/apache/jasper/Constants.java
    tomcat/tc7.0.x/trunk/java/org/apache/jasper/servlet/JspServlet.java
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
    tomcat/tc7.0.x/trunk/webapps/docs/config/systemprops.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1626741

Modified: tomcat/tc7.0.x/trunk/java/org/apache/jasper/Constants.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/jasper/Constants.java?rev=1626742&r1=1626741&r2=1626742&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/jasper/Constants.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/jasper/Constants.java Mon Sep 22 11:44:15 2014
@@ -74,8 +74,11 @@ public class Constants {
      * servlet definition.  If present on a request, this overrides the
      * value returned by <code>request.getServletPath()</code> to select
      * the JSP page to be executed.
+     * @deprecated  This will be removed in Tomcat 9.0.x onwards. It is replaced
+     *              by the use of the jspFile servlet initialisation parameter
      */
-    public static final String JSP_FILE = 
+    @Deprecated
+    public static final String JSP_FILE =
         System.getProperty("org.apache.jasper.Constants.JSP_FILE", "org.apache.catalina.jsp_file");
 
 

Modified: tomcat/tc7.0.x/trunk/java/org/apache/jasper/servlet/JspServlet.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/jasper/servlet/JspServlet.java?rev=1626742&r1=1626741&r2=1626742&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/jasper/servlet/JspServlet.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/jasper/servlet/JspServlet.java Mon Sep 22 11:44:15 2014
@@ -276,6 +276,7 @@ public class JspServlet extends HttpServ
     }
     
 
+    @SuppressWarnings("deprecation") // Use of JSP_FILE to be removed in 9.0.x
     @Override
     public void service (HttpServletRequest request, 
                              HttpServletResponse response)
@@ -284,9 +285,13 @@ public class JspServlet extends HttpServ
         String jspUri = jspFile;
 
         if (jspUri == null) {
-            // JSP specified via <jsp-file> in <servlet> declaration and supplied through
-            //custom servlet container code
-            jspUri = (String) request.getAttribute(Constants.JSP_FILE);
+            // JSP specified via <jsp-file> in <servlet> declaration and
+            // supplied through custom servlet container code
+            String jspFile = (String) request.getAttribute(Constants.JSP_FILE);
+            if (jspFile != null) {
+                jspUri = jspFile;
+                request.removeAttribute(Constants.JSP_FILE);
+            }
         }
         if (jspUri == null) {
             /*

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1626742&r1=1626741&r2=1626742&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Mon Sep 22 11:44:15 2014
@@ -215,6 +215,11 @@
         files. Reported by Coverity Scan. Based on patch provided by Felix
         Schumacher. (violetagg)
       </fix>
+      <fix>
+        <bug>56991</bug>: Deprecate the use of a request attribute to pass a
+        &lt;jsp-file&gt; declaration to Jasper and prevent an infinite loop
+        if this technique is used in conjunction with an include. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="WebSocket">

Modified: tomcat/tc7.0.x/trunk/webapps/docs/config/systemprops.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/config/systemprops.xml?rev=1626742&r1=1626741&r2=1626742&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/config/systemprops.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/config/systemprops.xml Mon Sep 22 11:44:15 2014
@@ -194,6 +194,9 @@
       JSP page to be executed.</p>
       <p>If not specified, the default value of
       <code>org.apache.catalina.jsp_file</code> will be used.</p>
+      <p><strong>Deprecated:</strong> This will be removed in Tomcat 9.0.x
+      onwards. It is replaced by the use of the jspFile servlet initialisation
+      parameter</p>
     </property>
 
     <property name="org.apache.jasper.Constants. PRECOMPILE">



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