| Summary: | Adding a servlet results in an inappropriate deletion of filter in web.xml | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [WebTools] WTP Java EE Tools | Reporter: | Alexander Ryan <alexander.j.ryan> | ||||||
| Component: | jst.servlet | Assignee: | jst.servlet <jst.servlet-inbox> | ||||||
| Status: | NEW --- | QA Contact: | Chuck Bridgham <cbridgha> | ||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | ccc, dimitar.giormov, shr31223 | ||||||
| Version: | 3.2 | ||||||||
| Target Milestone: | Future | ||||||||
| Hardware: | Macintosh | ||||||||
| OS: | Mac OS X - Carbon (unsup.) | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
Alexander, judging by the build ID, I am assuming that you encountered this with the Eclipse Helios release, which corresponds to WTP 3.2. Judging by the fact that I cannot reproduce this with a Web 2.5 project, but can reproduce it with a Web 2.4 project, I am assuming that you used a Web 2.4 (or older) project. If either of these assumptions are incorrect, please update this bug. I am assigning this to Kaloyan for initial investigation. Please retarget/reassign as appropriate. Yes it is Helios. Yes it is a web 2.4 project. Created attachment 187187 [details]
create fake servlet object with name *
The root cause of the problem is that in the transformation from EMF2DOM the model tries to resolve the reference of filter-mapping's servlet-name to a real servlet, in the case where the servlet name is * it fails to resolve it and thus removes it from the DOM tree.
The fix will create a fake servlet emf object that is not related to the model and return it as the referenced object.
I am not sure that this is the correct way to fix this, but at least there is no data loss. I don't like this patch... Can you take a look at the translator itself?
it uses the SourceLinkTranslator that passes in a flag ... here is the method in question:
public static Translator createFilterMapping13Translator() {
GenericTranslator result = new GenericTranslator(FILTER_MAPPING, WEBAPP_PKG.getWebApp_FilterMappings());
result.setChildren(new Translator[] {
new SourceLinkTranslator(FILTER_NAME, WEBAPP_PKG.getFilterMapping_Filter(),
new TranslatorPath(new Translator[] {
new Translator(WEB_APP, Translator.CONTAINER_FEATURE),
new Translator(FILTER, WEBAPP_PKG.getWebApp_Filters()),
new Translator(FILTER_MAPPING, WEBAPP_PKG.getFilter_Name())
})),
new Translator(URL_PATTERN, WEBAPP_PKG.getFilterMapping_UrlPattern()),
new SourceLinkTranslator(SERVLET_NAME, WEBAPP_PKG.getFilterMapping_Servlet(),
new TranslatorPath(new Translator[] {
new Translator(WEB_APP, Translator.CONTAINER_FEATURE),
new Translator(SERVLET, WEBAPP_PKG.getWebApp_Servlets()),
new Translator(SERVLET_NAME, WEBAPP_PKG.getServlet_ServletName())
}), Translator.STRING_RESULT_OK),
});
return result;
}
please take a look at changing here to avoid removing the node if not resolvable.
I cannot find a way to fix this using the translators, re-targeting for 3.3, since potential fix could compromise the stability of the build. Removing review until we find another solution Created attachment 195209 [details]
A second patch
New patch proposed.
Basically the changes are in FilterMapping implementation as well as in the involded translator (org.eclipse.wst.common.internal.emf.resource.SourceLinkTranslator).
re-targeting for SR1 re-targeting SR1 re-targeting 3.3.2 Hi Chuck, we are lost here, frankly I am not sure if the translators could help. Can you give us a hand or point us to someone who is more familiar with the translators. Basically we tried out different approaches, but we were unsuccessful. thanks, Dimitar |
Build Identifier: 20100617-1415 Selecting to add a new servlet to a web app is causing a line of code to get deleted from web.xml that should not be. <filter> <description> </description> <display-name> PersistentSessionFilter</display-name> <filter-name>PersistentSessionFilter</filter-name> <filter-class>net.visualocity.filters.PersistentSessionFilter</filter-class> </filter> <filter-mapping> <filter-name>PersistentSessionFilter</filter-name> <servlet-name>*</servlet-name> </filter-mapping> <filter-mapping> <filter-name>PersistentSessionFilter</filter-name> <url-pattern>*.jsp</url-pattern> </filter-mapping> The line that gets deleted is <servlet-name>*</servlet-name> This happens EVERY time I add a new servlet Reproducible: Always Steps to Reproduce: 1.Add a filter to a web app with an entry like the one I specified above. 2.Simply add a new servlet to your app 3.Observe that eclipse tells you there is a problem with your web.xml