IDPv3 internationalization via links and cookies
Brent Putman
putmanb at georgetown.edu
Tue Nov 3 13:27:22 EST 2015
On 11/3/15 12:34 PM, Cantor, Scott wrote:
> On 11/3/15, 12:25 PM, "users on behalf of Brent Putman" <users-bounces at shibboleth.net on behalf of putmanb at georgetown.edu> wrote:
>
>
>> Since we're adding that support, I'd say just allowing users to add a new LocaleResolver (or change the default) there might be safer. That way we don't hardcode something in that's difficult or impossible for deployers to change.
> That's fine for now certainly.
I was just refreshing my memory on MVC locale support [1]. Definitely
don't think we want to put this in system config, it needs to be
user-configurable.
Like other MVC defaults, the LocaleResolver used is one of those
"special" bean types [2], which gets defaulted in resource
org.springframework.web.servlet.DispatcherServlet.properties:
org.springframework.web.servlet.LocaleResolver=org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver
So if we're being conservative, we probably don't want to
override/replace that (although their cookie one does default to
falling back to the HTTP Accept-Language header value exposed via
HttpServletRequest#getLocale()).
Users may want/need to write custom impls also.
Re: changing the locale: I have in the past played around with the
interceptor Simon mentions [3]. As I recall, it worked OK for me, but
that was just in plain MVC. I don't know how usage is affected by SWF,
that probably needs more research.
There's at least the general question there of how one attaches
HandlerInterceptors when using the SWF HandlerMapping
(FlowHandlerMapping). Looks like it can be done the same way as the
others, by adding a List 'interceptors' property right on the handler
mapping bean:
<bean
class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping"
p:order="0" p:flowRegistry-ref="flowRegistry" />
But that bean is defined in our mvc-beans.xml system config. I guess we
*could* expose a list defined in user space. But probably better would
be to use the custom MVC XML support element <mvc:interceptors>. [4]
Again one would probably ideally want to do that in user-space config.
So that would have to be a 3.2 thing.
Simon, you could probably test this prior to 3.2 by just adding the
following to the bottom of your system/conf/mvc-beans.xml:
<!-- Import any user defined beans or overrides for the MVC config. -->
<import resource="../../conf/mvc-beans.xml" />
That's all 3.2 is adding here, I think. That would then allow you to
have that file exist in user-space conf, and try some of these things
out. If you get a chance to try, let us know how well it works.
--Brent
[1]
http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html#mvc-localeresolver
[2]
http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html#mvc-servlet-special-bean-types
[3]
http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html#mvc-localeresolver-interceptor
[4]
http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html#mvc-config-interceptors
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://shibboleth.net/pipermail/users/attachments/20151103/a13a30b7/attachment.html>
More information about the users
mailing list