Add i18n support for description and display-name elements in web.xml - #1064
Open
ABin-Huang wants to merge 7 commits into
Open
Add i18n support for description and display-name elements in web.xml#1064ABin-Huang wants to merge 7 commits into
ABin-Huang wants to merge 7 commits into
Conversation
Add a LocaleElement class to capture the content of locale-aware deployment descriptor elements together with their optional xml:lang attribute and use it to support multiple description and display-name elements with language variants throughout the descriptor model.
Add a LocaleElement class to capture the content of locale-aware deployment descriptor elements together with their optional xml:lang attribute and use it to support multiple description and display-name elements with language variants throughout the descriptor model. This commit updates the value classes: SecurityRoleRef (new description support), SecurityCollection, MessageDestination and ContextService.
Update ResourceBase (descriptions for env-entry, ejb-ref, ejb-local-ref, service-ref, resource-ref, resource-env-ref, message-destination-ref and message-destination), FilterDef and ServletDef to store locale-aware LocaleElement lists while preserving the String based compatibility getters and setters.
Update SecurityConstraint to store locale-aware descriptions and display names with full language support while preserving the String based compatibility getters and setters.
Replace the string based addCallMethod rules for description and display-name elements with a new LocaleElementRule that captures the element content together with the optional xml:lang attribute as a LocaleElement and adds it via the corresponding addDescription / addDisplayName method.
Add TestWebXmlI18n covering parsing of multi-language description and display-name elements (web-app, filter, servlet, security-role-ref, security-constraint, web-resource-collection, env-entry, resource-ref, message-destination), toXml round-tripping, setter replacement semantics and merge behaviour for both distinct languages and same language conflicts.
Store web-app level description and display-name elements as locale aware LocaleElement lists, output all locale aware elements with their optional xml:lang attribute in toXml() and merge descriptions and display names by language, detecting conflicts when two fragments define the same language.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR addresses the "WebXml Internationalization Support" item from TODO.md and implements internationalization support for the
descriptionanddisplay-nameelements inweb.xml/web-fragment.xml. Per the deployment descriptor specification, these elements may be repeated with differentxml:langattributes to provide multi-language metadata.Summary of changes
LocaleElementclass holding the element content and its optionalxml:langvalueResourceBase,FilterDef,ServletDef,SecurityRoleRef,SecurityConstraint,SecurityCollection,MessageDestination,ContextServiceandWebXmlnow storedescription/display-nameas lists ofLocaleElementWebXml.merge()combines elements from different languages and detects conflicts when two fragments define the same language with different contentWebRuleSetparses thexml:langattribute (with namespace URI fallback) and populates the new structures via a newLocaleElementRuletoXml()serializes all locale aware elements, including thexml:langattributeTesting
TestWebXmlI18nwith 11 test cases covering parsing, round-trip serialization, setter semantics and merge behaviourTestWebXml,TestWebRuleSet,TestWebXmlParser,TestSecurityConstraint,TestFilterDef,TestServletDef,TestWebXmlOrdering)ant validate -Dexecute.validate=true(checkstyle) passes