Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 312920 - The "Serve Modules Without Publishing" option should support web fragments projects for Tomcat 7
Summary: The "Serve Modules Without Publishing" option should support web fragments pr...
Status: CLOSED FIXED
Alias: None
Product: WTP ServerTools
Classification: WebTools
Component: jst.server (show other bugs)
Version: 3.2   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 3.2 RC2   Edit
Assignee: Larry Isaacs CLA
QA Contact: Angel Vera CLA
URL:
Whiteboard: PMC_approved
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-14 11:03 EDT by Larry Isaacs CLA
Modified: 2017-10-11 16:33 EDT (History)
1 user (show)

See Also:
david_williams: pmc_approved+
arvera: pmc_approved? (raghunathan.srinivasan)
arvera: pmc_approved? (naci.dai)
arvera: pmc_approved? (deboer)
arvera: pmc_approved? (neil.hauge)
arvera: pmc_approved? (kaloyan)
arvera: review+


Attachments
Patch to include JarScanner in customized Context for Tomcat 7 (3.21 KB, patch)
2010-05-14 11:03 EDT, Larry Isaacs CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Larry Isaacs CLA 2010-05-14 11:03:19 EDT
Created attachment 168545 [details]
Patch to include JarScanner in customized Context for Tomcat 7

The "Serve Modules Without Publishing" option for Tomcat 7 servers fails support certain Servlet 3.0 features for Web Fragment Projects.  Currently with this option enabled, Tomcat 7 will fail to discover the "META-INF/web-fragment.xml" file as well as a "META-INF/services/javax.servlet.ServletContainerInitializer" file, which declares a ServletContainerInitializer.  Fortunately, Tomcat 7 provides a simple way to address this.  Contexts can specify a JarScanner with the scanAllDirectories attribute set true.  This will cause directories on the web application's classpath to be checked as if they were expanded jars.  The attached patch makes use of this feature.

Unfortunately, there is currently a bug in Tomcat 7 that will cause it to fail to start if this feature is used.  I've entered https://bugs.eclipse.org/bugs/show_bug.cgi?id=311079 in the Apache Bugzilla to report this problem.  If it happens to get fixed in time, I hope to include this patch in WTP 3.2RC2, or possibly WTP 3.2RC3.  If not fixed in time, we'll have to save this for WTP 3.2.1.
Comment 1 Larry Isaacs CLA 2010-05-17 11:00:39 EDT
Angel,

The necessary changes to Tomcat 7 have been applied for Tomcat bug https://issues.apache.org/bugzilla/show_bug.cgi?id=49290 (somehow I pasted the wrong link above), so I would like to request this bug for PMC review for RC2, if you agree.  Here are the required details:

* Explain why you believe this is a stop-ship defect.

For Web Fragment Projects, the "META-INF/web-fragment.xml" file, and if present, a "META-INF/services/javax.servlet.ServletContainerInitializer" file will not be processed when the "Serve Modules Without Publishing" option is enabled.  Unless the web-fragment.xml file is essentially empty and the "javax.servlet.ServletContainerInitializer" file is not present, then the Web Fragment project will lose important Servlet 3.0 behavior when this option is enabled.

* Is there a work-around? If so, why do you believe the work-around is
insufficient? 

No work-around to get these Servlet 3.0 features working with this option enabled.

* How has the fix been tested? Is there a test case attached to the bugzilla
record? Has a JUnit Test been added?

I have verified the fix to Tomcat 7 for  has been applied and have built a local copy of Tomcat 7 for testing.  I've manually tested the WTP fix and verified that has the desired effect on the server configuration and that Tomcat starts successfully thanks to the fix that was applied.  A servlet mapping in a web-fragment.xml was functional and a ServletContainerInitializer was successfully called.  No JUnit has been implemented.

* Give a brief technical overview. Who has reviewed this fix?

The mechanism by which Tomcat 7 detects and processes "web-fragment.xml" and "javax.servlet.ServletContainerInitializer" files in jars doesn't work with the current abilities of the "Serve Modules Without Publishing" option.  Fortunately, Tomcat 7 provides a new feature where you can request that directories on the web application classpath be checked as if they were expanded jars.  This patch enables that feature for Tomcat 7 servers.

* What is the risk associated with this fix?

Minimal.  The changes affects only an isolated feature of the Tomcat server
adapter, and alters behavior in a limited code path.
Comment 2 Angel Vera CLA 2010-05-17 15:26:31 EDT
This changes affect only tomcat 7 and only the "Serve Modules Without Publishing" feature. Getting this changes into the build will make the support of tomcat 7 and servlet 3.0 more solid, by the time that WTP 3.2 releases.
Comment 3 Larry Isaacs CLA 2010-05-19 14:23:08 EDT
Adding PMC to Whiteboard so this bug shows up in the review list.
Comment 4 David Williams CLA 2010-05-19 14:52:57 EDT
I think it is good to make this support more solid, and appears low risk. 

Thank you.
Comment 5 Larry Isaacs CLA 2010-05-20 07:02:30 EDT
Changes released to HEAD.
Comment 6 Larry Isaacs CLA 2010-05-21 10:29:43 EDT
Verified "META-INF/web-fragment.xml" and "META-INF/services/javax.servlet.ServletContainerInitializer" are being picked up using WTP S-3.2.0RC2-20100520232028 build.
Comment 7 Larry Isaacs CLA 2010-05-21 10:30:02 EDT
Closing.
Comment 8 Eclipse Genie CLA 2017-10-11 16:33:52 EDT
New Gerrit change created: https://git.eclipse.org/r/108958