tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <knst.koli...@gmail.com>
Subject Re: Offline generation of effective web.xml
Date Tue, 11 Sep 2012 13:33:33 GMT
2012/9/11 Violeta Georgieva <milesg78@gmail.com>:
> It would be very useful if I can provide this as part of the build
> infrastructure for example.
> If you can give me a hint from where to start I may try to provide a patch
> for 8.0.x? Wdyt?
>
>
> 2012/9/11 Mark Thomas <markt@apache.org>
>
>>  Violeta Georgieva <violetagg@apache.org> wrote:
>>
>> >Hi,
>> >
>> >I do know that if I provide "logEffectiveWebXml=true" in my context.xml
>> >then the effective web.xml will be logged in the log files during
>> >application start.
>> >
>> >Is there a way (library etc.) that I can use to generated effective
>> >web.xml
>> >offline i.e. without starting the application.
>> >
>> >Thanks in advance.
>> >Violeta
>>
>> No, although I am beginning to think about refactoring the web.xml
>> scanning for 8.0.x for other reasons but any such refactoring should make
>> this trivial.
>>
>> I haven't got much further than "it would be useful if..." so it may turn
>> out to be impractical.
>>

1. Logging the effective web.xml is performed in
o.a.c.startup.ContextConfig.
Search for
org.apache.tomcat.util.scan.Constants.MERGED_WEB_XML

2. I would like to remove this MERGED_WEB_XML
from future versions. Instead of re-parsing web.xml Jasper would
better be using Servlet API to query needed features.

IIRC, actually Jasper does not need much: just specification version
and jsp-config.

A downside is that Jasper has to be used stand-alone as JspC. So it
should still be able to parse web.xml. So either
a) refactor the whole parsing of web.xml, moving it into reusable
component (like Mark wrote),  or
b) keep the current parsing code in Jasper and make its own objects
implement relevant parts of Servlet API.

This is filed as BZ53737. The first attempt was in r1377511
(+discussion), reverted in r1377539.

https://issues.apache.org/bugzilla/show_bug.cgi?id=53737
http://markmail.org/message/dyuyuuglunuy4qej
http://markmail.org/message/kknk2xh7wdcznsv7

3. Note, that currently this "merged web xml" may miss some features.

- It may change the order of elements vs. original web.xml. There are
a number of elements whose order is not important. Tomcat uses HashMap
for those, so their order may change randomly from run to run.

- It may miss some elements from original web.xml, that are not parsed
by Tomcat. Such as <description>s.

Several weeks ago I went through the code, correcting some typos in
element names and wrong order of elements.

Best regards,
Konstantin Kolinko

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


Mime
View raw message