Bug 49916 - use an init-param for jspFile on explicit jsp servlets
use an init-param for jspFile on explicit jsp servlets
Product: Tomcat 7
Classification: Unclassified
Component: Jasper
PC All
: P2 normal (vote)
: ---
Assigned To: Tomcat Developers Mailing List
Depends on:
  Show dependency tree
Reported: 2010-09-11 02:10 UTC by david jencks
Modified: 2010-10-01 13:29 UTC (History)
0 users

patch to translate jsp-file elements to jspServlet init params (23.55 KB, application/octet-stream)
2010-09-11 02:10 UTC, david jencks

Note You need to log in before you can comment on or make changes to this bug.
Description david jencks 2010-09-11 02:10:28 UTC
Created attachment 26017 [details]
patch to translate jsp-file elements to jspServlet init params

A <servlet> element in web.xml can include a jsp-file rather than a servlet class. Currently in catalina and jasper this is handled by a bunch of runtime code that tracks the jsp file outside the servlet and feeds it to the servlet as a request attribute.  This requires a bunch of runtime code, some of which is marked "hold your nose".

Instead, it's possible to supply the jsp-file as an init-param to the jsp servlet instance that is set up to handle this <servlet> element.  This makes runtime handling of these jsp servlets identical to all other servlets and transfers the small amount of jsp-aware code still needed in catalina to the deployment phase.

The attached patch appears to pass all the tomcat tests and doesn't appear to cause any tck problems in the geronimo-tomcat integration.

In this patch, JspServlet will still respond to the jsp file as a request attribute but catalina won't send it.  Thus jasper is backwards compatible with earlier catalina versions but catalina is not backward compatible for explicitly mentioned jsp-file in servlet elements with earlier jasper versions.

It would be helpful to geronimo to apply the JspServlet patch even if the catalina changes aren't applied as we are using this technique in the geronimo-jetty integration and are subclassing JspServlet to provide this behavior.
Comment 1 Mark Thomas 2010-10-01 13:29:24 UTC
Looks good to me. Thanks for the patch. It has been applied to trunk and will be included in 7.0.3 onwards.