lukaszlenart opened a new pull request, #1594:
URL: https://github.com/apache/struts/pull/1594

   ## Summary
   
   Fixes [WW-5549](https://issues.apache.org/jira/browse/WW-5549)
   
   - Fix `request_locale` / `request_cookie_locale` parameters being ignored 
when `supportedLocale` is configured on the I18nInterceptor
   - Apply `supportedLocale` as a global filter on all locale sources (request 
params, session, cookies)
   - Reject stale session/cookie locales when `supportedLocale` configuration 
changes
   
   ## Problem
   
   When `supportedLocale` was configured, `AcceptLanguageLocaleHandler.find()` 
matched the Accept-Language header **before** `SessionLocaleHandler` / 
`CookieLocaleHandler` could check their explicit locale parameters 
(`request_locale`, `request_cookie_locale`). This made it impossible to switch 
locale via request parameters.
   
   Additionally, `supportedLocale` was only applied to Accept-Language matching 
— locales from request params, session storage, and cookies were never 
validated against it.
   
   ## Changes
   
   - **Reorder locale resolution priority**: explicit request parameters 
(`request_locale`, `request_cookie_locale`) are now checked **before** 
Accept-Language fallback
   - **Add `isLocaleSupported()` helper**: validates a locale against the 
`supportedLocale` set (no-op when empty, preserving backward compatibility)
   - **Filter all locale sources**: request params, session-stored locales, and 
cookie-stored locales are all validated against `supportedLocale`
   - **Add 4 test cases** covering the bug scenario and supportedLocale 
filtering
   
   ## Test plan
   
   - [x] All 18 tests in `I18nInterceptorTest` pass (14 existing + 4 new)
   - [ ] Verify `request_locale` works with `supportedLocale` configured 
(SESSION storage)
   - [ ] Verify unsupported `request_locale` is rejected and falls back
   - [ ] Verify stale session locale is rejected when `supportedLocale` changes
   - [ ] Verify `request_cookie_locale` works with `supportedLocale` (COOKIE 
storage)
   - [ ] Full backward compatibility when `supportedLocale` is not configured
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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]

Reply via email to