czw., 27 mar 2025 o 16:15 Ute Kaiser <ut...@web.de.invalid> napisał(a):
> I wrote a LocaleInterceptor to catch the language from request URL path, 
> either German or Englisch. Output contains language specific fields from 
> database.
> Unfortunately, after server restart the first call has always German output.
>
> What I learned from debugging:
> I18nInterceptor.class is first called, then my LocaleInterceptor where I set 
> session.setAttribute("WW_TRANS_I18N_LOCALE", Locale.US).
> Then I18nInterceptor.class again with: Object sessionLocale = 
> invocation.getInvocationContext().getSession().get(attributeName) => NULL => 
> locale = super.read(invocation) => set to "de" (I guess, my laptop's default)
> Then myAction class is called, routing to a jsp that creates output with the 
> help of a custom tag. This uses 
> ActionContext.getContext().getLocale().getLanguage().toUpperCase() => DE.
>
> All works fine for second and further calls because there is no call to 
> I18nInterceptor.class before my LocaleInterceptor.
> When I18nInterceptor.class is called => Object sessionLocale = 
> invocation.getInvocationContext().getSession().get(attributeName) => 
> sessionLocale is set to en_US
>
> What can I do?
> Maybe WW_TRANS_I18N_LOCALE, 
> invocation.getInvocationContext().getSession().get(attributeName) and 
> ActionContext.getContext().getLocale() are not the same?

Not sure if I understand, did you overwrite the I18N interceptor or
just added a new one to your default stack?
Are you sure the secession has been already created at this point?


Cheers
Łukasz

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to