tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Jasper improvements
Date Wed, 26 Jun 2013 19:58:38 GMT

On 6/26/13 2:57 PM, Jeremy Boynes wrote:
> On Jun 26, 2013, at 7:49 AM, Christopher Schultz <>
>> Jeremy,
>> On 6/26/13 1:44 AM, Jeremy Boynes wrote:
>>> On Jun 11, 2013, at 1:50 PM, Nick Williams
>>> <> wrote:
>>>> Okay. One of many reasons I ask is that I still have it on my to-do
>>>> to make some improvements on the JSP compiler to support things
>>>> like 1) precompiling all JSPs on deploy and 2) a better Ant task. I
>>>> don't know how much the EL changes might affect this JSP
>>>> compilation (hopefully it's fairly decoupled), and I'd like that to
>>>> not seriously hinder any effort to back-port my improvements to
>>>> Tomcat 7. I'm wondering if this needs to move higher on my list and
>>>> get in before the EL changes. Any insight?
>>> I have been thinking about improvements to Jasper as well around
>>> better support for Servlet 3.0 concepts. One area would be decoupling
>>> it from Tomcat, bootstrapping using an SCI as hinted in
>>> ContextConfig. I'd also be interested in improving the Ant task as
>>> well, such as support for pre-compiling a separate package that would
>>> be treated as a web fragment (including web.xml-less pre-compilation,
>>> generating a web-fragment.xml rather than a web.xml snippet or
>>> potentially eliminating the XML entirely if the generated code can be
>>> annotated with @WebServlet). 
>> I tried some forays into this a few years ago, but got stuck in the
>> confusion of how everything works together. I wanted to do something
>> simple like get the web-app's spec-version number, but could not figure
>> out how to do it.
> I find usage and implementation very confusing as well - an example being things that
can be configured on the Task vs. init-params for the JSP servlet vs. things set via system
properties. A challenge here is that cleaning it up would likely warrant incompatible changes
so would be out for 7.x but potentially possible for 8.x - I'd be interested in what people
think about a major refactor that allowed incompatible changes (assuming they were justified
not arbitrary).
> You wrote in the bug that "annotation's don't make sense" - could you
> clarify that?

Yes: I was thinking that generating classes that used annotations would
be a good idea. In retrospect, I don't believe it would be a good idea
-- at least not by default. Since we are generating a web-fragment,
there's no need to use annotations. We could also cheat and not use a
web-fragment and instead use annotations.

> I was thinking that we could have Jasper add @WebServlet("/foo.jsp")
> to the class generated for "foo.jsp" and then that would be picked up
> by a container as part of its normal scan.

While that is possible, I see no reason not to explicitly-map the
servlets individually in a web-fragment. The user can then easily edit
the single output file (web-fragment.xml) and modify it if necessary.
For instance, maybe some JSPs shouldn't be called directly.

> BTW, can't we use ServletContext#getEffectiveMajorVersion() to
> determine the spec-version number?

Sure we can, but JspC doesn't provide a ServletContext...


View raw message