Author: markt Date: Mon Sep 22 11:41:06 2014 New Revision: 1626741 URL: http://svn.apache.org/r1626741 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/trunk/java/org/apache/jasper/Constants.java tomcat/trunk/java/org/apache/jasper/servlet/JspServlet.java tomcat/trunk/webapps/docs/changelog.xml tomcat/trunk/webapps/docs/config/systemprops.xml Modified: tomcat/trunk/java/org/apache/jasper/Constants.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/Constants.java?rev=1626741&r1=1626740&r2=1626741&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/Constants.java (original) +++ tomcat/trunk/java/org/apache/jasper/Constants.java Mon Sep 22 11:41:06 2014 @@ -69,7 +69,10 @@ 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 */ + @Deprecated public static final String JSP_FILE = System.getProperty("org.apache.jasper.Constants.JSP_FILE", "org.apache.catalina.jsp_file"); Modified: tomcat/trunk/java/org/apache/jasper/servlet/JspServlet.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/servlet/JspServlet.java?rev=1626741&r1=1626740&r2=1626741&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/jasper/servlet/JspServlet.java (original) +++ tomcat/trunk/java/org/apache/jasper/servlet/JspServlet.java Mon Sep 22 11:41:06 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) @@ -285,9 +286,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/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1626741&r1=1626740&r2=1626741&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Mon Sep 22 11:41:06 2014 @@ -189,6 +189,11 @@ Fix a potential resource leak in JDTCompiler when checking wether a resource is a package. Reported by Coverity Scan. (fschumacher) </fix> + <fix> + <bug>56991</bug>: 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. (markt) + </fix> </changelog> </subsection> <subsection name="WebSocket"> Modified: tomcat/trunk/webapps/docs/config/systemprops.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/systemprops.xml?rev=1626741&r1=1626740&r2=1626741&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/config/systemprops.xml (original) +++ tomcat/trunk/webapps/docs/config/systemprops.xml Mon Sep 22 11:41:06 2014 @@ -198,6 +198,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-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org