lukaszlenart opened a new issue, #147: URL: https://github.com/apache/struts-intellij-plugin/issues/147
## Context Struts 7.5.0 publishes new `struts.xml` grammar. The plugin still bundles configuration DTDs through `struts-6.0.dtd`, so a 6.5 or 7.5 DOCTYPE is unrecognized and the new syntax is invalid in the editor. The published catalog is https://struts.apache.org/dtds/. Compared with the bundled 6.0 DTD: - `struts-6.5.dtd` adds `final` on `<package>`. - `struts-7.5.dtd` adds `final` and `extension` on `<package>`, `<scoped-constant name value>`, and `http-method` and `extension` on `<action>`. Release notes: https://cwiki.apache.org/confluence/spaces/WW/pages/462816288/Version+Notes+7.5.0 ## Proposal Static DTD and DOM update, in the same style as the 7.2.1 constant metadata. One DOM model continues to serve every DTD version. The bundled DTD for a file decides whether the new syntax is legal there. ### DTDs and templates - Copy `struts-6.5.dtd` and `struts-7.5.dtd` from the catalog unchanged. - Register each `https` system URI and public ID in `StrutsConstants` and `Struts2ResourceProvider`, and add the URIs to `STRUTS_DTDS` so `StrutsDtdValidator` accepts them. - Add `struts_6_5.xml` and `struts_7_5.xml` file templates. - Extend the version cascade in `StrutsFileTemplateProvider` so a detected 6.5.x module gets the 6.5 DOCTYPE and a detected 7.5.x module gets the 7.5 DOCTYPE. ### DOM - `StrutsPackage` gains `final`, `extension`, and a list of `<scoped-constant>`. - `Action` gains `http-method` and `extension`. - `<scoped-constant>` has required `name` and `value`, the same shape as `<constant>`. - `final` is a boolean attribute, the same as `abstract`. ### Checks - When `extends` resolves to a package whose `final` is true, highlight that `extends` value. Struts rejects it at startup with "Parent package is final and unextendable". - `<scoped-constant name>` completion is the static scopable set intersected with constants already registered for the module: - `struts.ui.theme` - `struts.ui.templateDir` - `struts.convention.result.path`, only when the Convention contributor is active - `value` uses the existing constant-value converter, so `struts.ui.theme` offers `simple`, `xhtml`, `css_xhtml`, `html5`, and deprecated `ajax`. The other two stay free text. - A scoped-constant name outside that set is highlighted. A custom `ScopableConstants` bean is still reported. - `http-method` is a comma-separated list. Completion offers `GET`, `HEAD`, `POST`, `PUT`, `DELETE`, `TRACE`, `OPTIONS`, `CONNECT`, and `PATCH`. A token matches ignoring case. Any other token is highlighted. - `extension` is a comma-separated list on `<package>` and `<action>`. There is no fixed completion list. A token is highlighted when it starts with `.`, contains `/`, or contains whitespace. An empty token is kept, because it allows an extensionless URL. ## Out of scope - OGNL property resolution and the `@StrutsParameter` inspection - Tag libraries and validators, which already come from the Struts JAR on the classpath - Struts 1, Tiles, and XWork DTDs on the same catalog - Reading `ScopableConstants` implementations from the classpath ## Acceptance criteria - [ ] A file with the 6.5 or 7.5 DOCTYPE is accepted by `StrutsDtdValidator` and validated against the bundled DTD - [ ] `<package final>`, `<package extension>`, `<scoped-constant>`, `<action http-method>`, and `<action extension>` are part of the DOM - [ ] Extending a `final` package is highlighted - [ ] Scoped-constant name and value completion follow the rules above, and an unknown scopable name is highlighted - [ ] Unknown `http-method` tokens and illegal `extension` tokens are highlighted - [ ] Creating `struts.xml` in a 6.5.x module uses the 6.5 DOCTYPE, and in a 7.5.x module uses the 7.5 DOCTYPE - [ ] Older DOCTYPEs keep their current templates ## References - `Struts2ResourceProvider`, `StrutsConstants.STRUTS_DTDS`, `StrutsDtdValidator` - `StrutsPackage`, `Action`, `Constant`, `ConstantValueConverter` - `StrutsFileTemplateProvider`, `fileTemplates/j2ee/struts_6_0.xml.ft` - `Struts2ModelInspectionVisitor` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
