You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Christian Grobmeier <gr...@gmail.com> on 2013/06/13 14:12:11 UTC
I18ninterceptor support for cookies
Hi,
today i started to look into the I18nInterceptor because I wanted
to add the feature to store the Locale in a cookie, besides request-only
and session.
I could do it like that:
ActionContext ac = invocation.getInvocationContext();
HttpServletResponse response = (HttpServletResponse)
ac.get(StrutsStatics.HTTP_RESPONSE);
But the I18NInterceptor lives in xwork-core, and that package doesn't
have a dependency to
the servlet-api nor struts-core.
Currently I do not see a clean way to access the servlet response from
an interceptor living in xwork. I also can't move it to struts-core,
because it would require me to change
the package name which would be a breaking change.
Any ideas how to solve it?
Otherwise i would create an issue for Struts 3, when the xwork package
most likely will disappear or when breaking changes are allowed.
Cheers
Christian
--
http://www.grobmeier.de
https://www.timeandbill.de
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: I18ninterceptor support for cookies
Posted by Lukasz Lenart <lu...@apache.org>.
2013/6/13 Christian Grobmeier <gr...@gmail.com>:
> On Thu, Jun 13, 2013 at 2:48 PM, Lukasz Lenart <lu...@apache.org> wrote:
>> 2013/6/13 Christian Grobmeier <gr...@gmail.com>:
>>> Any ideas how to solve it?
>>>
>>> Otherwise i would create an issue for Struts 3, when the xwork package
>>> most likely will disappear or when breaking changes are allowed.
>>
>> The current idea is to keep XWork a standalone project - someone can
>> use it in non-servlet environment. I also opt to merge XWork into
>> Struts2 core, but maybe I'm missing something.
>
> OK. Not sure if anybody out there uses XWork in that way...
> it explains at least the lack of cookie support in the i18n interceptor.
>
>> Regarding your problem you've already answered your question - extend
>> and use as default I18N interceptor in struts-default.xml
>
> Maybe it makes sense to create such an i18n Interceptor for
> struts-core, which extends
> the xwork-core one. I believe in a web env it is normal use cookies to00 store
> language settings, if the user doesn't have a session.
>
> WDYT?
Good idea :-)
Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: I18ninterceptor support for cookies
Posted by Christian Grobmeier <gr...@gmail.com>.
On Thu, Jun 13, 2013 at 2:48 PM, Lukasz Lenart <lu...@apache.org> wrote:
> 2013/6/13 Christian Grobmeier <gr...@gmail.com>:
>> Any ideas how to solve it?
>>
>> Otherwise i would create an issue for Struts 3, when the xwork package
>> most likely will disappear or when breaking changes are allowed.
>
> The current idea is to keep XWork a standalone project - someone can
> use it in non-servlet environment. I also opt to merge XWork into
> Struts2 core, but maybe I'm missing something.
OK. Not sure if anybody out there uses XWork in that way...
it explains at least the lack of cookie support in the i18n interceptor.
> Regarding your problem you've already answered your question - extend
> and use as default I18N interceptor in struts-default.xml
Maybe it makes sense to create such an i18n Interceptor for
struts-core, which extends
the xwork-core one. I believe in a web env it is normal use cookies to00 store
language settings, if the user doesn't have a session.
WDYT?
Christian
>
>
> Regards
> --
> Łukasz
> + 48 606 323 122 http://www.lenart.org.pl/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
--
http://www.grobmeier.de
https://www.timeandbill.de
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: I18ninterceptor support for cookies
Posted by Lukasz Lenart <lu...@apache.org>.
2013/6/13 Christian Grobmeier <gr...@gmail.com>:
> Hi,
>
> today i started to look into the I18nInterceptor because I wanted
> to add the feature to store the Locale in a cookie, besides request-only
> and session.
>
> I could do it like that:
>
> ActionContext ac = invocation.getInvocationContext();
> HttpServletResponse response = (HttpServletResponse)
> ac.get(StrutsStatics.HTTP_RESPONSE);
>
> But the I18NInterceptor lives in xwork-core, and that package doesn't
> have a dependency to
> the servlet-api nor struts-core.
>
> Currently I do not see a clean way to access the servlet response from
> an interceptor living in xwork. I also can't move it to struts-core,
> because it would require me to change
> the package name which would be a breaking change.
>
> Any ideas how to solve it?
>
> Otherwise i would create an issue for Struts 3, when the xwork package
> most likely will disappear or when breaking changes are allowed.
The current idea is to keep XWork a standalone project - someone can
use it in non-servlet environment. I also opt to merge XWork into
Struts2 core, but maybe I'm missing something.
Regarding your problem you've already answered your question - extend
and use as default I18N interceptor in struts-default.xml
Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org