我使用的Webflow并想当前Locale添加到流动。 我已经有一个resolveLocale方法与此签名确实这样:

public Locale resolveLocale (HttpServletRequest request);

我想补充这样的事情在我的Webflow XML:

<on-start>
<evaluate expression="localeService.resolveLocale(???)" result="flowScope.locale"/>
</on-start>

现在,我不知道该放什么???参数部分。点击 有任何想法吗?感谢您阅读。

有帮助吗?

解决方案

我没有使用过的Web流量,但假定它类似于Spring的其它部分,你可以使用RequestContextHolder这一点。快速谷歌搜索显示,网络流量,甚至给你的网络的特定流RequestContextHolder - 甚至更好

其他提示

要访问一个简单的方法的区域设置为弹簧的LocaleContextHolder的

只需调用:LocaleContextHolder.getLocale()

HTTP:// static.springsource.org/spring/docs/2.5.x/api/org/springframework/context/i18n/LocaleContextHolder.html

您可以得到HttpServletRequest的这种风格

(HttpServletRequest)RequestContextHolder.getRequestContext().getExternalContext().getNativeRequest()

谢谢你的提示。我使用下面的行中我的服务(我的SWF-配置使用SessionLocaleResolver):

Locale locale = (Locale) RequestContextHolder.getRequestAttributes().getAttribute(SessionLocaleResolver.LOCALE_SESSION_ATTRIBUTE_NAME, RequestAttributes.SCOPE_SESSION);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top