Can jsp-file be a JspServlet init-param?
I've recently rewritten the geronimo-jetty integration to work off the servlet 3 *Registration classes. This works great except for servlets backed by jsp files, since there's no way to tell the servlet container through the ServletRegistration interface that its actually something with this extra jsp file name that needs to be added through some special process into the request. However, its easy to subclass the JspServlet so it gets the jsp file value from an init param, and of course its easy to set the init param from the web.xml. This appears to work fine. Is there some reason I've missed that this is a bad idea? If not, would the jasper community consider a patch to modify the JspServlet so it directly looks for such an init-param? And would the tomcat community consider simplifying the runtime code to use this init-param instead of a Constants.JSP_FILE request attribute? thanks david jencks - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Can jsp-file be a JspServlet init-param?
On 09/09/2010 00:54, David Jencks wrote: > I've recently rewritten the geronimo-jetty integration to work off the > servlet 3 *Registration classes. This works great except for servlets backed > by jsp files, since there's no way to tell the servlet container through the > ServletRegistration interface that its actually something with this extra jsp > file name that needs to be added through some special process into the > request. That looks like an oversight in the 3.0 spec. > However, its easy to subclass the JspServlet so it gets the jsp file value > from an init param, and of course its easy to set the init param from the > web.xml. This appears to work fine. > > Is there some reason I've missed that this is a bad idea? Well, it would be container specific rather than defined by the spec but since the spec offers no way to define it, I don't see there is a choice. > If not, would the jasper community consider a patch to modify the JspServlet > so it directly looks for such an init-param? Patches always get considered. > And would the tomcat community consider simplifying the runtime code to use > this init-param instead of a Constants.JSP_FILE request attribute? As usual, it would depend on the patch. Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Can jsp-file be a JspServlet init-param?
On Sep 8, 2010, at 11:48 PM, Mark Thomas wrote: > On 09/09/2010 00:54, David Jencks wrote: >> I've recently rewritten the geronimo-jetty integration to work off the >> servlet 3 *Registration classes. This works great except for servlets >> backed by jsp files, since there's no way to tell the servlet container >> through the ServletRegistration interface that its actually something with >> this extra jsp file name that needs to be added through some special process >> into the request. > > That looks like an oversight in the 3.0 spec. I'm not sure why you think that. A servlet extension mechanism such as a jsp engine can use the servlet 3 API to add servlets directly. I think it would make more sense to completely remove any mention of jsp from web.xml and the servlet spec and run jsps off a separate configuration file. > >> However, its easy to subclass the JspServlet so it gets the jsp file value >> from an init param, and of course its easy to set the init param from the >> web.xml. This appears to work fine. >> >> Is there some reason I've missed that this is a bad idea? > > Well, it would be container specific rather than defined by the spec but > since the spec offers no way to define it, I don't see there is a choice. The existing way of using a servlet request attribute to feed the jsp file to the instance of the jsp servlet set up for a particular servlet element is also not mentioned in the spec. It does need some special attention on each request. My proposal moves all the jsp-aware code in catalina to the deploy phase and allows treating these explicitly set up JspServlet instances just like any other servlet. > >> If not, would the jasper community consider a patch to modify the JspServlet >> so it directly looks for such an init-param? > > Patches always get considered. excellent, see https://issues.apache.org/bugzilla/show_bug.cgi?id=49916 If I've understood the tomcat build this passes all the tests and also appears to cause no tck problems in the geronimo-tomcat integration. > >> And would the tomcat community consider simplifying the runtime code to use >> this init-param instead of a Constants.JSP_FILE request attribute? > > As usual, it would depend on the patch. thanks! david jencks > > Mark > > - > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org > For additional commands, e-mail: dev-h...@tomcat.apache.org > - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: Can jsp-file be a JspServlet init-param?
On 11/09/2010 07:20, David Jencks wrote: > > On Sep 8, 2010, at 11:48 PM, Mark Thomas wrote: > >> On 09/09/2010 00:54, David Jencks wrote: >>> I've recently rewritten the geronimo-jetty integration to work off the >>> servlet 3 *Registration classes. This works great except for servlets >>> backed by jsp files, since there's no way to tell the servlet container >>> through the ServletRegistration interface that its actually something with >>> this extra jsp file name that needs to be added through some special >>> process into the request. >> >> That looks like an oversight in the 3.0 spec. > > I'm not sure why you think that. Because is the only element of a servlet's configuration you can't set via the registration class. I can't see any good reason for the omission, hence my thinking it was an oversight. > A servlet extension mechanism such as a jsp engine can use the servlet 3 > API to add servlets directly. I think it would make more sense to completely > remove any mention of jsp from web.xml and the servlet spec and run jsps off > a separate configuration file. Nice idea but unlikely to happen based on past experience. The Servlet (and JSP) EGs have bent over backwards to ensure backwards compatibility. I can't recall any feature being removed and I doubt something as significant as this would be removed from the Servlet spec. > excellent, see https://issues.apache.org/bugzilla/show_bug.cgi?id=49916 I'm currently at 49884, working my way down the bug list prior to a 7.0.3 release so I'll look at this before then (unless one of the other committers beats me to it). > If I've understood the tomcat build this passes all the tests and also > appears to cause no tck problems in the geronimo-tomcat integration. Sounds good. Mark - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org