You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2010/11/05 15:13:50 UTC

JSP Precompilation and Servlet 3.0

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

All,

Tim has just given his talk at ApacheCon NA about Servlet 3.0 / Tomcat
7.0. It was really my first taste of the 3.0 spec and I had a thought
about the new features available for webapp configuration /other/ than
web.xml:

- - web.xml fragments
- - class annotations

The current method for JSP precompilation (which I've never used, mind
you, so forgive my ignorance if I'm incorrect) is cumbersome:

- - run the compiler
- - copy the new .class files somewhere
- - drop a huge load of junk into web.xml

It occurred to me that that these new servlet 3.0 features could help
JSP precompilation. Let's see what Tomcat 7.0's JSP precompiler could do
(roughly):

$ jsp-precompile /path/to/jsps my-jsps.jar
$ cp my-jsps.jar /path/to/webapps/mywebapp/WEB-INF/lib

(done)

The precompiler could translate and compile all of the classes and
package them into a .jar file for you. Great. What about servlet
mappings? Well, we have two options:

1. Use annotations in the translated .java files
2. Generate a web.xml fragment and stuff it into
   my-jsps.jar/WEB-INF/web-fragment.xml

Does anyone have any preferences? I suppose it could be an option to the
precompiler, or we could even do both (do duplicate mappings conflict?).

Hopefully, this will make JSP precompilation less onerous for users.

Thanks,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzUER4ACgkQ9CaO5/Lv0PCfUgCgtgRRQd+Qw6X2aLDWyHq0STbd
UzgAnR7DtoAKbzLOdRSLWFPX4Qjp9UN5
=k337
-----END PGP SIGNATURE-----

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


Re: JSP Precompilation and Servlet 3.0

Posted by Tim Funk <fu...@apache.org>.
While I like the idea of using web-fragment.xml for precompiled jsp's - 
it would require the "meta-data complete" flag to be set to false which 
may as a side effect allow other artifacts to be loaded too.

Hopefully jsp-precompile is part of the webapp build/deploy process so a 
developer can ignore it during development. But an admin (or release 
manager) can ensure that all jsps do compile before release is deployed.

Setting up jsp-precompilation is a PITA the first time or 2 but once you 
get the hang of it, the precompilation step can be part of a standard 
snippet which can be pulled in via ant import.  (For those of us who 
love ant)

-Tim

On 11/5/2010 10:13 AM, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> All,
>
> Tim has just given his talk at ApacheCon NA about Servlet 3.0 / Tomcat
> 7.0. It was really my first taste of the 3.0 spec and I had a thought
> about the new features available for webapp configuration /other/ than
> web.xml:
>
> - - web.xml fragments
> - - class annotations
>
> The current method for JSP precompilation (which I've never used, mind
> you, so forgive my ignorance if I'm incorrect) is cumbersome:
>
> - - run the compiler
> - - copy the new .class files somewhere
> - - drop a huge load of junk into web.xml
>
> It occurred to me that that these new servlet 3.0 features could help
> JSP precompilation. Let's see what Tomcat 7.0's JSP precompiler could do
> (roughly):
>
> $ jsp-precompile /path/to/jsps my-jsps.jar
> $ cp my-jsps.jar /path/to/webapps/mywebapp/WEB-INF/lib
>
> (done)
>
> The precompiler could translate and compile all of the classes and
> package them into a .jar file for you. Great. What about servlet
> mappings? Well, we have two options:
>
> 1. Use annotations in the translated .java files
> 2. Generate a web.xml fragment and stuff it into
>     my-jsps.jar/WEB-INF/web-fragment.xml
>
> Does anyone have any preferences? I suppose it could be an option to the
> precompiler, or we could even do both (do duplicate mappings conflict?).
>
> Hopefully, this will make JSP precompilation less onerous for users.
>
> Thanks,
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkzUER4ACgkQ9CaO5/Lv0PCfUgCgtgRRQd+Qw6X2aLDWyHq0STbd
> UzgAnR7DtoAKbzLOdRSLWFPX4Qjp9UN5
> =k337
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>

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


Re: JSP Precompilation and Servlet 3.0

Posted by Tim Funk <fu...@apache.org>.
An  enhancement bug has been entered for those with the itch. It appears 
the existing JspC task still writes out 2.3 when it writes a new web.xml.

https://issues.apache.org/bugzilla/show_bug.cgi?id=50234

-Tim


On 11/8/2010 5:45 AM, Ronald Klop wrote:
> +1 Precompiled jsp's with annotations in a jar.

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


Re: JSP Precompilation and Servlet 3.0

Posted by Ronald Klop <ro...@base.nl>.
+1 Precompiled jsp's with annotations in a jar.


Op vrijdag, 5 november 2010 21:07 schreef Pid <pi...@pidster.com>:
> 
>  
> 
> 
> On 05/11/2010 15:06, Christopher Schultz wrote:
> > Chuck,
> > 
> > On 11/5/2010 10:57 AM, Caldarale, Charles R wrote:
> >>> From: Christopher Schultz [mailto:chris@christopherschultz.net] 
> >>> Subject: JSP Precompilation and Servlet 3.0
> > 
> >>> Hopefully, this will make JSP precompilation less onerous for
> >>> users.
> > 
> >> I don't think the current mechanism is particularly onerous, since
> >> Tomcat supplies an ant script to do all the dirty work, including the
> >> update of web.xml.
> > 
> > My understanding is that the ant script needs some "help" to get
> > started: you can't simply run the JSP precompiler against an existing
> > webapp without seeding web.xml, at least a bit.
> 
> I suggested generating annotated java a little while back and didn't get
> an overly enthusiastic reception, but I like the general idea of the
> JSPs being in their own jar.
> 
> I think it would be good if Tomcat 7.0 featured and used Servlet 3.0
> functions, the source is available and it'll help users get to know the
> spec.
> 
> 
> p
> 
> 
> 
> 
> 
> 
> 
> 
> 


Re: JSP Precompilation and Servlet 3.0

Posted by Pid <pi...@pidster.com>.
On 05/11/2010 15:06, Christopher Schultz wrote:
> Chuck,
> 
> On 11/5/2010 10:57 AM, Caldarale, Charles R wrote:
>>> From: Christopher Schultz [mailto:chris@christopherschultz.net] 
>>> Subject: JSP Precompilation and Servlet 3.0
> 
>>> Hopefully, this will make JSP precompilation less onerous for
>>> users.
> 
>> I don't think the current mechanism is particularly onerous, since
>> Tomcat supplies an ant script to do all the dirty work, including the
>> update of web.xml.
> 
> My understanding is that the ant script needs some "help" to get
> started: you can't simply run the JSP precompiler against an existing
> webapp without seeding web.xml, at least a bit.

I suggested generating annotated java a little while back and didn't get
an overly enthusiastic reception, but I like the general idea of the
JSPs being in their own jar.

I think it would be good if Tomcat 7.0 featured and used Servlet 3.0
functions, the source is available and it'll help users get to know the
spec.


p

Re: JSP Precompilation and Servlet 3.0

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chuck,

On 11/5/2010 10:57 AM, Caldarale, Charles R wrote:
>> From: Christopher Schultz [mailto:chris@christopherschultz.net] 
>> Subject: JSP Precompilation and Servlet 3.0
> 
>> Hopefully, this will make JSP precompilation less onerous for
>> users.
> 
> I don't think the current mechanism is particularly onerous, since
> Tomcat supplies an ant script to do all the dirty work, including the
> update of web.xml.

My understanding is that the ant script needs some "help" to get
started: you can't simply run the JSP precompiler against an existing
webapp without seeding web.xml, at least a bit.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzUHXIACgkQ9CaO5/Lv0PC0cACfWLkBucT/iYWJAqjYWhiNGs6B
9QoAniBXum2f5kKIJxRHVpgPa6wymP7Q
=sSBm
-----END PGP SIGNATURE-----

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


RE: JSP Precompilation and Servlet 3.0

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Christopher Schultz [mailto:chris@christopherschultz.net] 
> Subject: JSP Precompilation and Servlet 3.0

> Hopefully, this will make JSP precompilation less onerous for users.

I don't think the current mechanism is particularly onerous, since Tomcat supplies an ant script to do all the dirty work, including the update of web.xml.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


Re: JSP Precompilation and Servlet 3.0

Posted by Mikolaj Rydzewski <mi...@ceti.pl>.
 On Fri, 05 Nov 2010 10:13:50 -0400, Christopher Schultz 
 <ch...@christopherschultz.net> wrote:

> The precompiler could translate and compile all of the classes and
> package them into a .jar file for you. Great. What about servlet
> mappings? Well, we have two options:
>
> 1. Use annotations in the translated .java files
> 2. Generate a web.xml fragment and stuff it into
>    my-jsps.jar/WEB-INF/web-fragment.xml
>
> Does anyone have any preferences? I suppose it could be an option to 
> the
> precompiler, or we could even do both (do duplicate mappings 
> conflict?).
>
> Hopefully, this will make JSP precompilation less onerous for users.

 Personally I do not like JSP precompiling.

 1. I do not put into JSP anything that user should not see.
 2. Cost of compilation with first request is acceptable.
 3. Possibility to change produced markup either by me or customer is 
 priceless.

-- 
 Mikolaj Rydzewski <mi...@ceti.pl>

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