Skip to content

feat(action-extension): add example for global, package and action extensions - #555

Merged
lukaszlenart merged 4 commits into
mainfrom
feat/action-extension-example
Nov 13, 2026
Merged

lukaszlenart merged 4 commits into
mainfrom
feat/action-extension-example

Conversation

@lukaszlenart

Copy link
Copy Markdown
Member

Summary

Adds a new action-extension example module for the per-package / per-action extension attribute added in Apache Struts 7.5.0 (WW-4164).

Layer Config URL
Global struts.action.extension=action /hello.action
Package <package name="legacy" namespace="/legacy" extension="do"> /legacy/orders.do
Action <action name="report" extension=""> /legacy/report
  • The pages link to each action with s:url/s:a and print the generated URL. Every link gets the target action's extension, whether it is rendered on a .action, .do or extensionless page.
  • Plain wrong-extension links show the two failure modes:
    • legacy/orders.action and legacy/report.do are rejected by the actionExtension interceptor and render a mapped bad-extension result.
    • hello.do is a plain 404. hello declares no extension, so it never claims .do.
  • The README covers the resolution order (action → package → parent packages → global), the list format, how generated URLs pick an extension, and a note that extensions are not access control.
  • The design and plan are in docs/superpowers/.

Notes

  • The test extends StrutsJUnit4TestCase. StrutsTestCase.getActionProxy does not put the ActionMapping into the action context, so actionExtension lets every request through and a rejection test would pass vacuously.
  • Pages live under WEB-INF/jsp/. A top-level index.jsp redirects to index.action, because the global list has no empty entry and a /index welcome file would not map.

Test plan

  • ./mvnw -pl action-extension test: 9 tests covering the three mappings, hello.do not mapping, and both rejections
  • ./mvnw -B clean package: full reactor BUILD SUCCESS
  • Jetty smoke check: generated hrefs correct on index.action, legacy/report and legacy/orders.do; hello.do returns 404; orders.action/report.do render bad-extension; direct JSP access returns 404; the root URL redirects to the index

🤖 Generated with Claude Code

lukaszlenart and others added 4 commits November 13, 2026 15:09
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tensions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd rejection

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lukaszlenart
lukaszlenart marked this pull request as ready for review November 13, 2026 14:22
@lukaszlenart
lukaszlenart merged commit ce03581 into main Nov 13, 2026
2 checks passed
@lukaszlenart
lukaszlenart deleted the feat/action-extension-example branch November 13, 2026 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant