Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 312288

Summary: Filter and Listener wizards should not be shown for Web 2.2 projects
Product: [WebTools] WTP Java EE Tools Reporter: Carl Anderson <ccc>
Component: jst.servletAssignee: Kaloyan Raev <kaloyan>
Status: RESOLVED FIXED QA Contact: Chuck Bridgham <cbridgha>
Severity: normal    
Priority: P2 CC: kaloyan
Version: 3.1Flags: cbridgha: review+
Target Milestone: 3.2.1   
Hardware: PC   
OS: Windows XP   
Whiteboard: EaseOfUse
Attachments:
Description Flags
patch none

Description Carl Anderson CLA 2010-05-10 12:08:05 EDT
Scenario to reproduce:

Create a Dynamic Web Project, specify the version as 2.2.
Bring up the context menu on the project
Select New and notice that both Filter and Listener are present.

If you use either the New Filter or New Listener wizard, you can also select a Web 2.2 project as the target project.  Finish is enabled.  However, once the wizard is finished, an error is shown in web.xml that states that:

The content of element type "web-app" must match "(icon?,display-name?,description?,distributable?,context-param*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*)".

This is correct, since both Filters and Listeners were introduced in the Servlet 2.3 specification.  We should not show the entries in the context menu and we should remove Web 2.2 projects from the list of selectable target projects for these two wizards.
Comment 1 Carl Anderson CLA 2010-05-10 12:09:59 EDT
Kaloyan, can your team investigate this?  Please retarget as appropriate.
Comment 2 Kaloyan Raev CLA 2010-05-11 02:54:46 EDT
Good catch. Honestly, I am not quite familiar with the older versions of the J2EE specification.
Comment 3 Kaloyan Raev CLA 2010-05-11 03:29:27 EDT
Not a major issue, nor a regression. Let's leave it for 3.2.1.
Comment 4 Kaloyan Raev CLA 2010-06-21 05:26:58 EDT
Created attachment 172312 [details]
patch

The attached patch resolves the problem with the following changes:
  1) Modifies the navigatorContent description, so the New Filter and New Listener wizards does not appear in the context menu of Web 2.2 projects
  2) Introduces new property tester that test the project facet of an ICompressedNode object. This is needed by 1)
  3) Removes the 'Filter', 'Filter Mapping' and 'Listener' nodes from the Web 2.2 DD tree
  4) Filters (does not show) Web 2.2 in the project list of New Filter and New Listener wizards.
Comment 5 Kaloyan Raev CLA 2010-06-21 05:28:12 EDT
Chuck, please review this patch for 3.2.1. 
Some of the changes may be considered as UI change. If you think so, please raise this bug for PMC approval.
Comment 6 Chuck Bridgham CLA 2010-06-22 10:30:44 EDT
Approved - talked it over with Carl, I don't think PMC is required on this change... only "removing" or filtering existing navigator content based on spec version
Comment 7 Kaloyan Raev CLA 2010-06-22 10:41:39 EDT
Committed to HEAD for 3.2.1 and 3.3