You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2010/12/16 21:48:47 UTC

Adding annotations to JspC

All,

I'm looking at writing a patch for bug 50234 ("JspC use servlet 3.0
features": https://issues.apache.org/bugzilla/show_bug.cgi?id=50234) and
I'm thinking that the annotations should actually have nothing to do
with the precompiler, but the compiler itself.

Can anyone think of a reason not to simply update
jasper.compiler.Generator to add the @WebServlet annotations? I believe
everything else needs to be handled by JspC.

-chris


Re: Adding annotations to JspC

Posted by Pid <pi...@pidster.com>.
On 17/12/2010 08:49, Konstantin Kolinko wrote:
> 2010/12/16 Christopher Schultz <ch...@christopherschultz.net>:
>> All,
>>
>> I'm looking at writing a patch for bug 50234 ("JspC use servlet 3.0
>> features": https://issues.apache.org/bugzilla/show_bug.cgi?id=50234) and
>> I'm thinking that the annotations should actually have nothing to do
>> with the precompiler, but the compiler itself.
>>
>> Can anyone think of a reason not to simply update
>> jasper.compiler.Generator to add the @WebServlet annotations? I believe
>> everything else needs to be handled by JspC.
>>
> 
> Note, that you still have to preserve compatibility for the webapps
> that adhere to Servlet 2.5 and earlier versions of specification.
> 
> Using JspC may be limited to Servlet 3.0+ ones (if it is worth it),
> but just deploying earlier versions of the webapps on Tomcat should
> still work.

JspC should know which spec version is defined in web.xml, so could
switch behaviour.

> Do you really need @WebServlet here? Are the jsp servlets discovered
> though annotations, or do you list them in web-fragment.xml ?

Does Tomcat automatically discover classes annotated with @WebServlet,
or must they be included in a JAR, with a web-fragment.xml?

I though the latter only.


p

Re: Adding annotations to JspC

Posted by Christopher Schultz <ch...@christopherschultz.net>.
All,

On 12/17/2010 10:59 AM, Christopher Schultz wrote:
> WEB-INF/web-fragment.xml

Sorry, meant to say META-INF/web-fragment.xml

-chris


Re: Adding annotations to JspC

Posted by Christopher Schultz <ch...@christopherschultz.net>.
Konstantin,

On 12/17/2010 3:49 AM, Konstantin Kolinko wrote:
> 2010/12/16 Christopher Schultz <ch...@christopherschultz.net>:
>> All,
>>
>> I'm looking at writing a patch for bug 50234 ("JspC use servlet 3.0
>> features": https://issues.apache.org/bugzilla/show_bug.cgi?id=50234) and
>> I'm thinking that the annotations should actually have nothing to do
>> with the precompiler, but the compiler itself.
>>
>> Can anyone think of a reason not to simply update
>> jasper.compiler.Generator to add the @WebServlet annotations? I believe
>> everything else needs to be handled by JspC.
>>
> 
> Note, that you still have to preserve compatibility for the webapps
> that adhere to Servlet 2.5 and earlier versions of specification.
> 
> Using JspC may be limited to Servlet 3.0+ ones (if it is worth it),
> but just deploying earlier versions of the webapps on Tomcat should
> still work.

I think that limiting the compiled servlets to Tomcat 7 (Servlet 3.0+)
is okay: the documentation states that JSPs should be recompiled using
the version of Tomcat you expect to use for deployment, so backward
compatibility isn't something I'm terribly concerned about.

> Do you really need @WebServlet here? Are the jsp servlets discovered
> though annotations, or do you list them in web-fragment.xml ?

The enhancement requests /both/ of those, actually: generating a formal
web-fragment.xml (the current implementation just dumps bare <servlet>
and <servlet-mapping> elements -- it's not currently a valid XML
document) as well as @WebServlet annotations on the classes. The idea is
that JspC could generate a JAR file that could be tossed-into a webapp
instead of having all those class files sitting around, and also having
to modify the webapp's web.xml file. With the annotations and/or a
WEB-INF/web-fragment.xml, the compiled JSPs could be detected and
configured automatically.

-chris


Re: Adding annotations to JspC

Posted by Konstantin Kolinko <kn...@gmail.com>.
2010/12/16 Christopher Schultz <ch...@christopherschultz.net>:
> All,
>
> I'm looking at writing a patch for bug 50234 ("JspC use servlet 3.0
> features": https://issues.apache.org/bugzilla/show_bug.cgi?id=50234) and
> I'm thinking that the annotations should actually have nothing to do
> with the precompiler, but the compiler itself.
>
> Can anyone think of a reason not to simply update
> jasper.compiler.Generator to add the @WebServlet annotations? I believe
> everything else needs to be handled by JspC.
>

Note, that you still have to preserve compatibility for the webapps
that adhere to Servlet 2.5 and earlier versions of specification.

Using JspC may be limited to Servlet 3.0+ ones (if it is worth it),
but just deploying earlier versions of the webapps on Tomcat should
still work.


Do you really need @WebServlet here? Are the jsp servlets discovered
though annotations, or do you list them in web-fragment.xml ?


Best regards,
Konstantin Kolinko

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