Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343207 - JSF Facet install delegate always modifies web.xml
Summary: JSF Facet install delegate always modifies web.xml
Status: RESOLVED FIXED
Alias: None
Product: Java Server Faces
Classification: WebTools
Component: JSF Tools (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.3 M7   Edit
Assignee: Ian Trimble CLA
QA Contact:
URL:
Whiteboard: PMC_approved
Keywords:
Depends on: 343324
Blocks:
  Show dependency tree
 
Reported: 2011-04-18 17:42 EDT by Slava Kabanovich CLA
Modified: 2017-12-19 13:26 EST (History)
4 users (show)

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


Attachments
UI, data model, and utility class changes to allow skipping web.xml configuration (21.66 KB, patch)
2011-04-21 19:24 EDT, Ian Trimble CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Slava Kabanovich CLA 2011-04-18 17:42:09 EDT
Build Identifier: I20100520-1744

In JSF 2.0, Faces Servlet declaration is not necessary in web descriptor. However, when configuring JSF facet for existing JSF 2.0 project, it is impossible to avoid web.xml being modified by insertion of servlet and mapping declarations. Besides, for web.xml of version 3.0, namespace xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" is inserted, which is an annoyance.

Could it be possible to add a configuration property to data model for JSF facet installer, that would prevent undesirable modifications to web descriptor? (e.g. IJSFFacetInstallDataModelProperties.SERVLET_IMPLICIT true/false; available for servlet version 2.0; in UI represented by a check box that enables/disables other inputs for servlet name and mapping.)

Reproducible: Always

Steps to Reproduce:
1. Import into Eclipse a JSF 2.0 project, which is not a facet project.
2. Convert it into Faceted project and add Dynamic Web Module Facet 3.0.
3. Reopen properties, and select JavaServer Faces facet to configure. 
Configuration is filled with default value in 'JSF servlet name' input field, and it would not permit to have it empty, or in any other way to indicate that no servlet declaration should be inserted into web descriptor.
Comment 1 Raghunathan Srinivasan CLA 2011-04-19 12:42:57 EDT
We will review this to see if we can make a non-UI change that adopters can use.
Comment 2 Ian Trimble CLA 2011-04-19 20:05:29 EDT
Bug 343324 has been logged to deal with the unused xmlns:web generation.
Comment 3 Ian Trimble CLA 2011-04-19 20:15:50 EDT
The JSF facet install delegate checks for a servlet in the web app model, finds none (which, in a Servlet 3.0 app, could be a bug in itself, since any annotated servlets/mappings found on the classpath should be in the web app model), then updates the model, which, in turn, causes WTP to write (or update) a web.xml file.

At this late stage in the Indigo release cycle (almost M7), it is too late to add UI or change data models. We could offer a system property that would prevent the logic that modifies the web app model from running, effectively meaning that any existing web.xml file is left untouched and no new web.xml file is created. Would this be beneficial?
Comment 4 Slava Kabanovich CLA 2011-04-20 12:22:34 EDT
Yes, if JSF facet install delegate checks that property every time before modifying web.xml, then tool that invokes JSF facet addition may adjust the property, and set it back afterwards.
Comment 5 Max Rydahl Andersen CLA 2011-04-20 13:05:23 EDT
Raghu/Ian,

Doesn't this qualify for an allowed fix if approved by PMC since the current behavior is broken for any JEE6 usage no matter if new or existing project as far as I can see ?
Comment 6 Raghunathan Srinivasan CLA 2011-04-20 16:36:09 EDT
Request PMC review and pre-approval to fix this issue which requires a change in UI post-M6. We will implement the fix and attach a patch if approved.

* Explain why you believe this is a stop-ship defect. Or, if it is a "hotbug" (requested by an adopter) please document it as such. 
The current implementation of the JSF Facet indirectly forces the creation of the web.xml file which is an incorrect behavior for one use case of JEE6 that uses Servlet 3.0 and JSF 2.0 technologies.
* Is there a work-around? If so, why do you believe the work-around is insufficient?
No suitable workaround. See comment 3 for a non-UI fix.
* How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added? 
NA
* Give a brief technical overview. Who has reviewed this fix? 
See comment 3
* What is the risk associated with this fix?
low
Comment 7 David Williams CLA 2011-04-20 17:33:12 EDT
Fine with me to fix this, but unclear if you mean by system-property-workaround, or a "real" fix with new UI. Either is fine with me ... just saying its unclear. 

Plus, normally PMC approval/review is requested after a concrete fix is proposed via patch ... that's part of any risk/benefit trade-off ... but, again, in principle, I'm fine with fixing this. Sounds pretty important. 

This is not a regression, I assume? Just an aspect of JSF 2.0 that's not been well tested? Just curious.
Comment 8 Raghunathan Srinivasan CLA 2011-04-20 17:49:35 EDT
(In reply to comment #7)
> Fine with me to fix this, but unclear if you mean by
> system-property-workaround, or a "real" fix with new UI. Either is fine with me
> ... just saying its unclear. 

The real-fix with the UI change in the JSF Facet related pages
> 
> Plus, normally PMC approval/review is requested after a concrete fix is
> proposed via patch ... that's part of any risk/benefit trade-off ... but,
> again, in principle, I'm fine with fixing this. Sounds pretty important. 
> 
This was a pre-approval request given it involves a UI change post-M6. We will submit a patch for review
> This is not a regression, I assume? Just an aspect of JSF 2.0 that's not been
> well tested? Just curious.
Not a regression.
Comment 9 Ian Trimble CLA 2011-04-21 19:24:40 EDT
Created attachment 193891 [details]
UI, data model, and utility class changes to allow skipping web.xml configuration
Comment 10 Ian Trimble CLA 2011-04-21 19:25:39 EDT
Patch now attached - would PMC please consider for M7?

Thanks,
 - Ian
Comment 11 Ian Trimble CLA 2011-04-25 12:38:33 EDT
Fix submitted at 2011/04/25 09:37AM PDT.
Comment 12 Ian Trimble CLA 2011-04-25 12:39:24 EDT
Forgot to toggle status - fixed.
Comment 13 Raghunathan Srinivasan CLA 2011-04-25 13:22:05 EDT
Please review if this can be released for the M7 build
Comment 14 Raghunathan Srinivasan CLA 2011-04-25 15:06:07 EDT
Released changes to M7
Comment 15 Eclipse Genie CLA 2017-12-18 20:17:09 EST
New Gerrit change created: https://git.eclipse.org/r/114285